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

Disable ts and jsx by default, remove esm #651

Merged
merged 2 commits into from
May 8, 2020
Merged
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
25 changes: 8 additions & 17 deletions bin/jack.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,25 +593,20 @@ Much more documentation available at: https://www.node-tap.org/
description: `Run JS tests in 'use strict' mode`,
}),

esm: flag({
default: process.env.TAP_NO_ESM !== '1',
description: `Run .js and .mjs with support for EcmaScript modules
(Default: true)`,
}),
flow: flag({
description: `Removes flow types`,
}),

ts: flag({
default: process.env.TAP_NO_TS !== '1',
default: process.env.TAP_TS === '1',
description: `Automatically load .ts and .tsx tests with tap's bundled
ts-node module (Default: true)`,
ts-node module (Default: false)`,
}),

jsx: flag({
default: process.env.TAP_NO_JSX !== '1',
default: process.env.TAP_JSX === '1',
description: `Automatically load .jsx tests using tap's bundled import-jsx
loader (Default: true)`,
loader (Default: false)`,
}),

'nyc-help': flag({
Expand Down Expand Up @@ -792,16 +787,12 @@ Much more documentation available at: https://www.node-tap.org/
description: `Set to '1' to set the --only flag`
})),

TAP_NO_ESM: env(flag({
description: `Set to '1' to disable automatic esm support`
})),

TAP_NO_TS: env(flag({
description: `Set to '1' to disable automatic typescript support`
TAP_TS: env(flag({
description: `Set to '1' to enable automatic typescript support`
})),

TAP_NO_JSX: env(flag({
description: `Set to '1' to disable automatic jsx support`
TAP_JSX: env(flag({
description: `Set to '1' to enable automatic jsx support`
})),

}, {
Expand Down
2 changes: 0 additions & 2 deletions bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const exists = require('fs-exists-cached').sync
const os = require('os')
const tsNode = require.resolve('ts-node/register')
const flowNode = require.resolve("flow-remove-types/register");
const esm = require.resolve('esm')
const jsx = require.resolve('./jsx.js')
const which = require('which')
const {ProcessDB} = require('istanbul-lib-processinfo')
Expand Down Expand Up @@ -679,7 +678,6 @@ const runAllFiles = (options, env, tap, processDB) => {
} else if (/\.jsx$|\.tsx?$|\.[mc]?js$/.test(file)) {
debug('js file', file)
const args = [
...(options.esm ? ['-r', esm] : []),
...options['node-arg'],
file,
...options['test-arg']
Expand Down
13 changes: 4 additions & 9 deletions docs/src/content/docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,20 +368,16 @@ Other Options:
--harmony Enable all Harmony flags in JavaScript tests
--strict Run JS tests in 'use strict' mode

--esm Run .js and .mjs with support for EcmaScript modules
(Default: true)

--no-esm switch off the --esm flag
--flow Removes flow types
--no-flow switch off the --flow flag

--ts Automatically load .ts and .tsx tests with tap's
bundled ts-node module (Default: true)
bundled ts-node module (Default: false)

--no-ts switch off the --ts flag

--jsx Automatically load .jsx tests using tap's bundled
import-jsx loader (Default: true)
import-jsx loader (Default: false)

--no-jsx switch off the --jsx flag

Expand Down Expand Up @@ -480,9 +476,8 @@ Environment Variables:
flag works.)

TAP_ONLY Set to '1' to set the --only flag
TAP_NO_ESM Set to '1' to disable automatic esm support
TAP_NO_TS Set to '1' to disable automatic typescript support
TAP_NO_JSX Set to '1' to disable automatic jsx support
TAP_TS Set to '1' to enable automatic typescript support
TAP_JSX Set to '1' to enable automatic jsx support

Config Files:

Expand Down
9 changes: 0 additions & 9 deletions docs/src/content/docs/using-with/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ redirect_from:
- /using-with
---

# Using tap with ESM

ES-Modules are supported by default, using the [esm](http://npm.im/esm) module.
If your test file ends in `.mjs`, then this will automatically use Node's
built-in experimental module system.

To turn _off_ ES-Module support (as may be required in some edge cases), run
your tests with `--no-esm`.

# Using tap with TypeScript

Name your test files `.ts` and they'll be loaded as TypeScript.
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@types/react": "^16.9.23",
"chokidar": "^3.3.0",
"coveralls": "^3.0.11",
"esm": "^3.2.25",
"findit": "^2.0.0",
"flow-remove-types": "^2.112.0",
"foreground-child": "^2.0.0",
Expand Down Expand Up @@ -70,7 +69,6 @@
"www:serve": "cd docs; npm run serve"
},
"tap": {
"esm": false,
"test-ignore": "/(^|/)cli-tests-[0-9]+/",
"check-coverage": true
},
Expand Down
1 change: 0 additions & 1 deletion scripts/snap.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

export TAP_SNAPSHOT=1
export TAP_NO_ESM=1
export TAP_BAIL=1

shopt -s globstar
Expand Down
1 change: 0 additions & 1 deletion settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if (+process.env.TAP_DEV_LONGSTACK !== 1) {
settings.stackUtils.ignoredPackages.push(
'libtap',
'tap',
'esm',
'nyc',
'import-jsx',
'function-loop'
Expand Down
40 changes: 16 additions & 24 deletions tap-snapshots/test-run-dump-config.js-TAP.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -49,7 +48,7 @@ test-env: []
test-ignore: /(^|/)cli-tests-[0-9]+/
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -71,15 +70,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -101,7 +99,7 @@ test-env: []
test-ignore: /(^|/)cli-tests-[0-9]+/
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -123,15 +121,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -153,7 +150,7 @@ test-env: []
test-ignore: $.
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -175,15 +172,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -205,7 +201,7 @@ test-env: []
test-ignore: $.
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -227,15 +223,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -257,7 +252,7 @@ test-env: []
test-ignore: $.
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -279,15 +274,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -309,7 +303,7 @@ test-env: []
test-ignore: /(^|/)cli-tests-[0-9]+/
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 0
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -333,7 +327,6 @@ coverage-report:
- json
- html
debug: true
esm: false
files: []
flow: false
functions: 100
Expand All @@ -343,7 +336,7 @@ grep:
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg:
- --expose-gc
Expand Down Expand Up @@ -374,7 +367,7 @@ test-env: []
test-ignore: /(^|/)cli-tests-[0-9]+/
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 99
ts: true
ts: false
version: false
versions: false
watch: false
Expand All @@ -396,15 +389,14 @@ coverage: false
coverage-map: null
coverage-report: []
debug: false
esm: false
files: []
flow: false
functions: 100
grep: []
help: false
invert: false
jobs: {number}
jsx: true
jsx: false
lines: 100
node-arg: []
nyc-arg: []
Expand All @@ -426,7 +418,7 @@ test-env: []
test-ignore: /(^|/)cli-tests-[0-9]+/
test-regex: ((\\/|^)(tests?|__tests?__)\\/.*|\\.(tests?|spec)|^\\/?tests?)\\.([mc]js|[jt]sx?)$
timeout: 30
ts: true
ts: false
version: false
versions: false
watch: false
Expand Down
Loading