@exodus/test 1.0.0-rc.92 → 1.0.0-rc.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bundler/bundle.js +24 -9
  2. package/package.json +1 -1
package/bundler/bundle.js CHANGED
@@ -38,15 +38,26 @@ const loadPipeline = [
38
38
  .replace(/\b(__dirname|import\.meta\.dirname)\b/g, JSON.stringify(dirname(filepath)))
39
39
  .replace(/\b(__filename|import\.meta\.filename)\b/g, JSON.stringify(filepath))
40
40
 
41
- if (filepath.endsWith('/node_modules/chalk/source/templates.js')) {
42
- // It has an invalid regex on which engine262 fails
43
- res = res.replace(
44
- 'const ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|{[a-f\\d]{1,6}})|x[a-f\\d]{2}|.)|([^\\\\])/gi;',
45
- 'const ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|([^\\\\])/giu;'
46
- )
47
- } else if (filepath.endsWith('/node_modules/qs/lib/parse.js')) {
48
- res = res.replace('var brackets = /(\\[[^[\\]]*])/;', 'var brackets = /(\\[[^[\\]]*\\])/;')
49
- res = res.replace('var child = /(\\[[^[\\]]*])/g;', 'var child = /(\\[[^[\\]]*\\])/g;')
41
+ if (options.platform === 'engine262') {
42
+ if (filepath.endsWith('/node_modules/chalk/source/templates.js')) {
43
+ // It has an invalid regex on which engine262 fails
44
+ res = res.replace(
45
+ 'const ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|{[a-f\\d]{1,6}})|x[a-f\\d]{2}|.)|([^\\\\])/gi;',
46
+ 'const ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|([^\\\\])/giu;'
47
+ )
48
+ } else if (filepath.endsWith('/node_modules/qs/lib/parse.js')) {
49
+ res = res.replace('var brackets = /(\\[[^[\\]]*])/;', 'var brackets = /(\\[[^[\\]]*\\])/;')
50
+ res = res.replace('var child = /(\\[[^[\\]]*])/g;', 'var child = /(\\[[^[\\]]*\\])/g;')
51
+ } else if (filepath.endsWith('/node_modules/url/url.js')) {
52
+ // .substr is not part of the main ECMA-262 spec
53
+ // We need this module for pathToFileURL
54
+ res = res.replace('&& protocol.substr(-1) !==', '&& protocol[protocol.length - 1] !==')
55
+ res = res.replace('= rest.substr(proto.length);', '= rest.substring(proto.length);')
56
+ res = res.replace('= rest.substr(2);', '= rest.substring(2);')
57
+ res = res.replace('= rest.substr(0, 2) ===', '= rest.substring(0, 2) ===')
58
+ } else if (filepath.endsWith('/node_modules/buffer/index.js')) {
59
+ res = res.replace('.substr(i * 2, 2)', '.substring(i * 2, i * 2 + 2)')
60
+ }
50
61
  }
51
62
 
52
63
  // Unneded polyfills
@@ -387,6 +398,10 @@ export const build = async (...files) => {
387
398
  'tape-promise/tape': resolveImport('../src/tape.cjs'),
388
399
  'node:test': resolveImport('../src/node.js'),
389
400
  'micro-should': resolveImport('../src/jest.js'),
401
+ // For cross-dir usage
402
+ '@exodus/test/jest': resolveImport('../src/jest.js'),
403
+ '@exodus/test/tape': resolveImport('../src/tape.cjs'),
404
+ '@exodus/test/node': resolveImport('../src/node.js'),
390
405
  // Inner
391
406
  'exodus-test:text-encoding-utf': api('text-encoding-utf.cjs'),
392
407
  'exodus-test:util-format': api('util-format.cjs'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/test",
3
- "version": "1.0.0-rc.92",
3
+ "version": "1.0.0-rc.93",
4
4
  "author": "Exodus Movement, Inc.",
5
5
  "description": "A test suite runner",
6
6
  "homepage": "https://github.com/ExodusMovement/test",