Repository navigation
Restore the JavaScript test suite - #499
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
`npm test`, which `make test` and CI run, has not been able to start since the ava 2.x upgrade: - ava 2 rejects the `ava.babel` key with "Unexpected Babel configuration for AVA". babel-register already reads .babelrc, so the key is redundant and can simply be dropped. - ava 2 treats CLI arguments as literal files and exits with "src/javascript/tests is not a test file." when given a directory. ava's default file patterns already match src/javascript/tests/**/*.spec.js, so no argument is needed. - `import ErlangTypes from 'erlang-types'` evaluates to undefined under babel 6. erlang-types sets __esModule and exports only named bindings, so _interopRequireDefault returns the module unchanged and `.default` is undefined, which made every spec fail with "Cannot read properties of undefined (reading 'PID')". A namespace import is the correct form for both babel and the rollup build. 71 tests pass with these changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npm test— whichmake testand CI both run — cannot start. Three separate problems, all introduced when the JS dependencies were bumped:1. ava rejects its own config
ava 2 only accepts
extensionsandtestOptionsunder thebabelkey.babel-registeralready reads.babelrcon its own, so the key is redundant and is simply dropped.2. The test script passes a directory
ava 2 resolves CLI arguments as literal paths. Its default file patterns already include
**/*.spec.js, and every file undersrc/javascript/tests/is one, so the argument is not needed.3. The default import of
erlang-typesis undefined under babel 6node_modules/erlang-types/lib/index.jssets__esModuleand exports only named bindings, so_interopRequireDefaultreturns the module unchanged and.defaultisundefined:which made every spec fail:
The rollup build tolerates the default import because
rollup-plugin-commonjsmaps a CJS module without a default export onto the namespace object, but a namespace import is the correct form for both toolchains.Changes
package.json: drop the invalidava.babelkey, changetesttonyc avacore.js,core/erlang_compat/{erlang,lists,maps}.js: useimport * as ErlangTypes from 'erlang-types'Testing
With these changes:
npm run buildstill succeeds, and the regeneratedpriv/testrunner/vendor.build.jsis byte-identical to the committed one.Note on
npm testitself: it could not be run end-to-end here.nyc avaaborts withCannot find module '...\node'because nyc 14 predates the Node version used for this check (the project pins Node 12.8.1 in.travis.yml). nyc is untouched by this PR, which is why the run above usesnpx avadirectly.