Skip to content

Commit

Permalink
Test snapshot support before Endo update
Browse files Browse the repository at this point in the history
  • Loading branch information
naugtur committed Dec 19, 2022
1 parent 6b4c094 commit 90e557d
Show file tree
Hide file tree
Showing 18 changed files with 7,821 additions and 28,298 deletions.
12 changes: 11 additions & 1 deletion test-imports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Each dependency has test cases generated for it checking if it works in cjs and

You can manually add test cases to `test-imports/cases` and all files there will run.

### Snapshots

`__snapshots__` folder contains a snapshot of all test results as they're unrealistic to turn 100% green. It's a proxy for detecting changes in ecosystem suport. Might evolve into something more advanced.

For now, if snapshots test is failing, you manually verify if it's a regression or improvement (or both)

### Adding cases

Default test cases are generated by running
Expand All @@ -45,7 +51,7 @@ npm run install-case 'packagename'
npm run generate-cases
```

Existing files will not be overwritten. To regenerate all cases from dependencies run `npm mrun generate-cases overwrite`
Existing files will not be overwritten. To regenerate all cases from dependencies run `npm run generate-cases overwrite`

### Test case format

Expand All @@ -57,6 +63,10 @@ A test case must export `expected` and `actual` - these two will be passed to Av
REJECTED cases can be solved by adding a transform. I'm not listing all cases of rejections because there's just too many
Scaffolding for these tests adds a transform to avoid the most common ones.

## react-dom

Currently missing a peer dependency. Leaving as is to see if Endo update fixes it.

## typescript

- triggers SES_HTML_COMMENT_REJECTED error from comments
Expand Down
220 changes: 220 additions & 0 deletions test-imports/__snapshots__/test-cjs.mjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Snapshot report for `test-cjs.mjs`

The actual snapshot is saved in `test-cjs.mjs.snap`.

Generated by [AVA](https://avajs.dev).

## \_\_ALL

> Snapshot 1
{
'_babel_types.cjs Endo can import': 'OK',
'_babel_types.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'_babel_types.cjs Endo imports default': 'OK',
'_babel_types.cjs Node.js baseline': 'OK',
'_babel_types.cjs import resolution matches': 'OK',
'_ethersproject_random.cjs Endo can import': 'OK',
'_ethersproject_random.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'_ethersproject_random.cjs Endo imports default': 'OK',
'_ethersproject_random.cjs Node.js baseline': 'OK',
'_ethersproject_random.cjs import resolution matches': 'OK',
'_noble_hashes_crypto.cjs Endo can import': 'OK',
'_noble_hashes_crypto.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'_noble_hashes_crypto.cjs Endo imports default': 'OK',
'_noble_hashes_crypto.cjs Node.js baseline': 'OK',
'_noble_hashes_crypto.cjs import resolution matches': 'OK',
'_noble_hashes_sha3.cjs Endo can import': `FAILED␊
Cannot find file for internal module "./crypto" (with candidates "./crypto", "./crypto.js", "./crypto/index.js") in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/`,
'_noble_hashes_sha3.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Cannot find file for internal module "./crypto" (with candidates "./crypto", "./crypto.js", "./crypto/index.js") in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/`,
'_noble_hashes_sha3.cjs Endo imports default': `FAILED␊
Cannot find file for internal module "./crypto" (with candidates "./crypto", "./crypto.js", "./crypto/index.js") in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/`,
'_noble_hashes_sha3.cjs Node.js baseline': 'OK',
'_noble_hashes_sha3.cjs import resolution matches': `FAILED␊
Cannot find file for internal module "./crypto" (with candidates "./crypto", "./crypto.js", "./crypto/index.js") in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/`,
'acorn.cjs Endo can import': 'OK',
'acorn.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'acorn.cjs Endo imports default': 'OK',
'acorn.cjs Node.js baseline': 'OK',
'acorn.cjs import resolution matches': 'OK',
'axios.cjs Endo can import': 'OK',
'axios.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'axios.cjs Endo imports default': 'OK',
'axios.cjs Node.js baseline': 'OK',
'axios.cjs import resolution matches': 'OK',
'bignumber.js.cjs Endo can import': 'OK',
'bignumber.js.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'bignumber.js.cjs Endo imports default': 'OK',
'bignumber.js.cjs Node.js baseline': 'OK',
'bignumber.js.cjs import resolution matches': 'OK',
'browser-resolve.cjs Endo can import': 'OK',
'browser-resolve.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'browser-resolve.cjs Endo imports default': 'OK',
'browser-resolve.cjs Node.js baseline': 'OK',
'browser-resolve.cjs import resolution matches': 'OK',
'browserify.cjs Endo can import': `FAILED␊
Cannot find module 'process/browser.js'␊
Add requireResolve to Endo Compartment Mapper readPowers.`,
'browserify.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Cannot find module 'process/browser.js'␊
Add requireResolve to Endo Compartment Mapper readPowers.`,
'browserify.cjs Endo imports default': `FAILED␊
Cannot find module 'process/browser.js'␊
Add requireResolve to Endo Compartment Mapper readPowers.`,
'browserify.cjs Node.js baseline': 'OK',
'browserify.cjs import resolution matches': `FAILED␊
Cannot find module 'process/browser.js'␊
Add requireResolve to Endo Compartment Mapper readPowers.`,
'css-loader.cjs Endo can import': `FAILED␊
Possible import expression rejected at file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/css-loader/dist/plugins/postcss-import-parser.js:158. (SES_IMPORT_REJECTED)`,
'css-loader.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Possible import expression rejected at file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/css-loader/dist/plugins/postcss-import-parser.js:158. (SES_IMPORT_REJECTED)`,
'css-loader.cjs Endo imports default': `FAILED␊
Possible import expression rejected at file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/css-loader/dist/plugins/postcss-import-parser.js:158. (SES_IMPORT_REJECTED)`,
'css-loader.cjs Node.js baseline': 'OK',
'css-loader.cjs import resolution matches': `FAILED␊
Possible import expression rejected at file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/css-loader/dist/plugins/postcss-import-parser.js:158. (SES_IMPORT_REJECTED)`,
'elliptic.cjs Endo can import': 'OK',
'elliptic.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'elliptic.cjs Endo imports default': 'OK',
'elliptic.cjs Node.js baseline': 'OK',
'elliptic.cjs import resolution matches': 'OK',
'elliptic_lib_elliptic_curves.js.cjs Endo can import': 'OK',
'elliptic_lib_elliptic_curves.js.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'elliptic_lib_elliptic_curves.js.cjs Endo imports default': 'OK',
'elliptic_lib_elliptic_curves.js.cjs Node.js baseline': 'OK',
'elliptic_lib_elliptic_curves.js.cjs import resolution matches': 'OK',
'eslint.cjs Endo can import': `FAILED␊
Cannot find external module "acorn" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/acorn-jsx/`,
'eslint.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Cannot find external module "acorn" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/acorn-jsx/`,
'eslint.cjs Endo imports default': `FAILED␊
Cannot find external module "acorn" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/acorn-jsx/`,
'eslint.cjs Node.js baseline': 'OK',
'eslint.cjs import resolution matches': `FAILED␊
Cannot find external module "acorn" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/acorn-jsx/`,
'ethereumjs-common.cjs Endo can import': 'OK',
'ethereumjs-common.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'ethereumjs-common.cjs Endo imports default': 'OK',
'ethereumjs-common.cjs Node.js baseline': 'OK',
'ethereumjs-common.cjs import resolution matches': 'OK',
'ethereumjs-util.cjs Endo can import': 'OK',
'ethereumjs-util.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'ethereumjs-util.cjs Endo imports default': 'OK',
'ethereumjs-util.cjs Node.js baseline': 'OK',
'ethereumjs-util.cjs import resolution matches': 'OK',
'ethers.cjs Endo can import': 'OK',
'ethers.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'ethers.cjs Endo imports default': 'OK',
'ethers.cjs Node.js baseline': 'OK',
'ethers.cjs import resolution matches': 'OK',
'fast-glob.cjs Endo can import': 'OK',
'fast-glob.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'fast-glob.cjs Endo imports default': 'OK',
'fast-glob.cjs Node.js baseline': 'OK',
'fast-glob.cjs import resolution matches': 'OK',
'is-array.cjs Endo can import': 'OK',
'is-array.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'is-array.cjs Endo imports default': 'OK',
'is-array.cjs Node.js baseline': 'OK',
'is-array.cjs import resolution matches': 'OK',
'json-rpc-engine.cjs Endo can import': 'OK',
'json-rpc-engine.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'json-rpc-engine.cjs Endo imports default': 'OK',
'json-rpc-engine.cjs Node.js baseline': 'OK',
'json-rpc-engine.cjs import resolution matches': 'OK',
'keccak.cjs Endo can import': 'OK',
'keccak.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'keccak.cjs Endo imports default': 'OK',
'keccak.cjs Node.js baseline': 'OK',
'keccak.cjs import resolution matches': 'OK',
'lodash.cjs Endo can import': 'OK',
'lodash.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'lodash.cjs Endo imports default': 'OK',
'lodash.cjs Node.js baseline': 'OK',
'lodash.cjs import resolution matches': 'OK',
'mime.cjs Endo can import': 'OK',
'mime.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'mime.cjs Endo imports default': 'OK',
'mime.cjs Node.js baseline': 'OK',
'mime.cjs import resolution matches': 'OK',
'multiformats.cjs Endo can import': `FAILED␊
Failed to load module "./cases/multiformats.cjs" in package "file:///home/naugtur/repo/endo-e2e-tests/test-imports/" (1 underlying failures: 'import' and 'export' may appear only with 'sourceType: "module"' (1:0)`,
'multiformats.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Failed to load module "./cases/multiformats.cjs" in package "file:///home/naugtur/repo/endo-e2e-tests/test-imports/" (1 underlying failures: 'import' and 'export' may appear only with 'sourceType: "module"' (1:0)`,
'multiformats.cjs Endo imports default': `FAILED␊
Failed to load module "./cases/multiformats.cjs" in package "file:///home/naugtur/repo/endo-e2e-tests/test-imports/" (1 underlying failures: 'import' and 'export' may appear only with 'sourceType: "module"' (1:0)`,
'multiformats.cjs Node.js baseline': 'OK',
'multiformats.cjs import resolution matches': `FAILED␊
Failed to load module "./cases/multiformats.cjs" in package "file:///home/naugtur/repo/endo-e2e-tests/test-imports/" (1 underlying failures: 'import' and 'export' may appear only with 'sourceType: "module"' (1:0)`,
'polycrc.cjs Endo can import': 'OK',
'polycrc.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'polycrc.cjs Endo imports default': 'OK',
'polycrc.cjs Node.js baseline': 'OK',
'polycrc.cjs import resolution matches': 'OK',
'prop-types.cjs Endo can import': 'OK',
'prop-types.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'prop-types.cjs Endo imports default': 'OK',
'prop-types.cjs Node.js baseline': 'OK',
'prop-types.cjs import resolution matches': 'OK',
'punycode.cjs Endo can import': 'OK',
'punycode.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'punycode.cjs Endo imports default': 'OK',
'punycode.cjs Node.js baseline': 'OK',
'punycode.cjs import resolution matches': 'OK',
'rc.cjs Endo can import': 'OK',
'rc.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'rc.cjs Endo imports default': 'OK',
'rc.cjs Node.js baseline': 'OK',
'rc.cjs import resolution matches': 'OK',
'react-dom.cjs Endo can import': `FAILED␊
Cannot find external module "react" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/react-dom/`,
'react-dom.cjs Endo import * gets _at least_ the exports Node.js got': `FAILED␊
Cannot find external module "react" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/react-dom/`,
'react-dom.cjs Endo imports default': `FAILED␊
Cannot find external module "react" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/react-dom/`,
'react-dom.cjs Node.js baseline': 'OK',
'react-dom.cjs import resolution matches': `FAILED␊
Cannot find external module "react" in package file:///home/naugtur/repo/endo-e2e-tests/test-imports/node_modules/react-dom/`,
'redux.cjs Endo can import': 'OK',
'redux.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'redux.cjs Endo imports default': 'OK',
'redux.cjs Node.js baseline': 'OK',
'redux.cjs import resolution matches': 'OK',
'sinon.cjs Endo can import': 'OK',
'sinon.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'sinon.cjs Endo imports default': 'OK',
'sinon.cjs Node.js baseline': 'OK',
'sinon.cjs import resolution matches': 'OK',
'storage.cjs Endo can import': 'OK',
'storage.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'storage.cjs Endo imports default': 'OK',
'storage.cjs Node.js baseline': 'OK',
'storage.cjs import resolution matches': 'OK',
'typescript.cjs Endo can import': 'OK',
'typescript.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'typescript.cjs Endo imports default': 'OK',
'typescript.cjs Node.js baseline': 'OK',
'typescript.cjs import resolution matches': 'OK',
'uuid.cjs Endo can import': 'OK',
'uuid.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'uuid.cjs Endo imports default': 'OK',
'uuid.cjs Node.js baseline': 'OK',
'uuid.cjs import resolution matches': 'OK',
'web3-eth.cjs Endo can import': 'OK',
'web3-eth.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'web3-eth.cjs Endo imports default': 'OK',
'web3-eth.cjs Node.js baseline': 'OK',
'web3-eth.cjs import resolution matches': 'OK',
'which.cjs Endo can import': 'OK',
'which.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'which.cjs Endo imports default': 'OK',
'which.cjs Node.js baseline': 'OK',
'which.cjs import resolution matches': 'OK',
'yargs.cjs Endo can import': 'OK',
'yargs.cjs Endo import * gets _at least_ the exports Node.js got': 'OK',
'yargs.cjs Endo imports default': 'OK',
'yargs.cjs Node.js baseline': 'OK',
'yargs.cjs import resolution matches': 'OK',
}
Binary file added test-imports/__snapshots__/test-cjs.mjs.snap
Binary file not shown.
Loading

0 comments on commit 90e557d

Please sign in to comment.