Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built-in support for TypeScript #368

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 84 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@
"dependencies": {
"@sentry/node": "^5.15.5",
"@types/glob": "^7.1.1",
"@types/puppeteer": "^5.4.0",
"argparse": "^1.0.10",
"axe-core": "^4.1.1",
"chokidar": "^3.4.2",
"diff": "^4.0.2",
"emailjs-imap-client": "^3.0.7",
"emailjs-mime-parser": "^2.0.5",
"errorstacks": "^1.1.5",
"esbuild": "^0.10.0",
"esbuild-register": "^2.3.0",
"form-data": "^2.3.3",
"glob": "^7.1.6",
"he": "^1.2.0",
Expand Down Expand Up @@ -134,7 +135,7 @@
"prettier": "^2.0.5",
"puppeteer": "^8.0.0",
"rimraf": "^3.0.2",
"ts-node": "^9.0.0",
"ts-node": "^9.1.1",
"typedoc": "^0.17.4",
"typescript": "^4.2.3"
},
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const {register} = require('esbuild-register/dist/node');
register({
sourcemap: true,
minify: false,
keepNames: false,
});

const {main} = require('./main');

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion tests/selftest_strange_exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function run() {
assert(output.some(line => line.includes('Non-error object thrown by throw_promise: [object Promise]')));
assert(output.some(line => line.includes('Non-error object thrown by throw_array: ["test"]')));
assert(output.some(line => line.includes('Non-error object thrown by throw_object: [object Object]')));
assert(output.some(line => line.includes('Non-error object thrown by throw_class: class Strange { }')));
assert(output.some(line => line.includes('Non-error object thrown by throw_class: class Strange {')));

// Not crashing is sufficient for us
const results = render.craftResults(runnerConfig, testInfo);
Expand Down
2 changes: 1 addition & 1 deletion tests/selftest_ts_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
const child_process = require('child_process');

async function run() {
const script = path.join(__dirname, '..', 'bin', 'cli.js');
const script = path.join(__dirname, 'ts_node', 'run');
const {stderr} = await new Promise((resolve, reject) => {
child_process.execFile(
process.execPath,
Expand Down
3 changes: 2 additions & 1 deletion tests/ts_node/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ const pentf = require('../../src/index.js');

pentf.main({
rootDir: __dirname,
});
testsGlob: '*.ts'
});
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"allowJs": true,
"alwaysStrict": true,
"strict": true,
Expand Down