| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../../common'); | |
| 4 | - const { path: fixture } = require('../../common/fixtures'); | ||
| 4 | + const fixtures = require('../../common/fixtures'); | ||
| 5 | 5 | const providers = require('./providers.cjs'); | |
| 6 | 6 | ||
| 7 | 7 | const assert = require('node:assert'); | |
| 8 | 8 | const { fork } = require('node:child_process'); | |
| 9 | - const option = `--openssl-config=${fixture('openssl3-conf', 'default_only.cnf')}`; | ||
| 9 | + const option = `--openssl-config=${fixtures.path('openssl3-conf', 'default_only.cnf')}`; | ||
| 10 | 10 | ||
| 11 | 11 | if (!process.execArgv.includes(option)) { | |
| 12 | 12 | const cp = fork(__filename, { execArgv: [option] }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../../common'); | |
| 4 | - const { path: fixture } = require('../../common/fixtures'); | ||
| 4 | + const fixtures = require('../../common/fixtures'); | ||
| 5 | 5 | const providers = require('./providers.cjs'); | |
| 6 | 6 | ||
| 7 | 7 | const assert = require('node:assert'); | |
| 8 | 8 | const { fork } = require('node:child_process'); | |
| 9 | - const option = `--openssl-config=${fixture('openssl3-conf', 'legacy_provider_enabled.cnf')}`; | ||
| 9 | + const option = `--openssl-config=${fixtures.path('openssl3-conf', 'legacy_provider_enabled.cnf')}`; | ||
| 10 | 10 | ||
| 11 | 11 | if (!process.execArgv.includes(option)) { | |
| 12 | 12 | const cp = fork(__filename, { execArgv: [option] }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../../common'); | |
| 4 | - const { path: fixture } = require('../../common/fixtures'); | ||
| 4 | + const fixtures = require('../../common/fixtures'); | ||
| 5 | 5 | const providers = require('./providers.cjs'); | |
| 6 | 6 | ||
| 7 | 7 | const assert = require('node:assert'); | |
| 8 | 8 | const { fork } = require('node:child_process'); | |
| 9 | - const option = `--openssl-config=${fixture('openssl3-conf', 'legacy_provider_inactive.cnf')}`; | ||
| 9 | + const option = `--openssl-config=${fixtures.path('openssl3-conf', 'legacy_provider_inactive.cnf')}`; | ||
| 10 | 10 | ||
| 11 | 11 | if (!process.execArgv.includes(option)) { | |
| 12 | 12 | const cp = fork(__filename, { execArgv: [option] }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,16 +7,17 @@ const { pathToFileURL } = require('url'); | |||
| 7 | 7 | const fixturesDir = path.join(__dirname, '..', 'fixtures'); | |
| 8 | 8 | ||
| 9 | 9 | function fixturesPath(...args) { | |
| 10 | - return path.join(fixturesDir, ...args); | ||
| 10 | + args.unshift(fixturesDir); | ||
| 11 | + return Reflect.apply(path.join, this, args); | ||
| 11 | 12 | } | |
| 12 | 13 | ||
| 13 | 14 | function fixturesFileURL(...args) { | |
| 14 | - return pathToFileURL(fixturesPath(...args)); | ||
| 15 | + return pathToFileURL(Reflect.apply(fixturesPath, this, args)); | ||
| 15 | 16 | } | |
| 16 | 17 | ||
| 17 | 18 | function readFixtureSync(args, enc) { | |
| 18 | 19 | if (Array.isArray(args)) | |
| 19 | - return fs.readFileSync(fixturesPath(...args), enc); | ||
| 20 | + return fs.readFileSync(Reflect.apply(fixturesPath, this, args), enc); | ||
| 20 | 21 | return fs.readFileSync(fixturesPath(args), enc); | |
| 21 | 22 | } | |
| 22 | 23 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { spawnPromisified } from '../common/index.mjs'; | |
| 2 | - import { fileURL } from '../common/fixtures.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | 3 | import assert from 'node:assert'; | |
| 4 | 4 | import { execPath } from 'node:process'; | |
| 5 | 5 | import { describe, it } from 'node:test'; | |
@@ -10,7 +10,7 @@ describe('ESM: warn for obsolete hooks provided', { concurrency: !process.env.TE | |||
| 10 | 10 | const { code, signal, stderr } = await spawnPromisified(execPath, [ | |
| 11 | 11 | '--input-type=module', | |
| 12 | 12 | '--eval', | |
| 13 | - `import ${JSON.stringify(fileURL('es-module-loaders', 'module-named-exports.mjs'))}`, | ||
| 13 | + `import ${JSON.stringify(fixtures.fileURL('es-module-loaders', 'module-named-exports.mjs'))}`, | ||
| 14 | 14 | ]); | |
| 15 | 15 | ||
| 16 | 16 | assert.doesNotMatch( | |
@@ -28,7 +28,7 @@ describe('ESM: warn for obsolete hooks provided', { concurrency: !process.env.TE | |||
| 28 | 28 | [ | |
| 29 | 29 | /`--experimental-loader` may be removed in the future/, | |
| 30 | 30 | '--experimental-loader', | |
| 31 | - fileURL('es-module-loaders', 'hooks-custom.mjs'), | ||
| 31 | + fixtures.fileURL('es-module-loaders', 'hooks-custom.mjs'), | ||
| 32 | 32 | ], | |
| 33 | 33 | ] | |
| 34 | 34 | ) { | |
@@ -37,7 +37,7 @@ describe('ESM: warn for obsolete hooks provided', { concurrency: !process.env.TE | |||
| 37 | 37 | ...args, | |
| 38 | 38 | '--input-type=module', | |
| 39 | 39 | '--eval', | |
| 40 | - `import ${JSON.stringify(fileURL('es-module-loaders', 'module-named-exports.mjs'))}`, | ||
| 40 | + `import ${JSON.stringify(fixtures.fileURL('es-module-loaders', 'module-named-exports.mjs'))}`, | ||
| 41 | 41 | ]); | |
| 42 | 42 | ||
| 43 | 43 | assert.match(stderr, /ExperimentalWarning/); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { spawnPromisified } from '../common/index.mjs'; | |
| 2 | - import * as fixtures from '../common/fixtures.js'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | 3 | import assert from 'node:assert/strict'; | |
| 4 | 4 | import { describe, it } from 'node:test'; | |
| 5 | 5 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,11 @@ | |||
| 1 | 1 | // Flags: --experimental-import-meta-resolve | |
| 2 | 2 | import { spawnPromisified } from '../common/index.mjs'; | |
| 3 | - import { fileURL as fixturesFileURL } from '../common/fixtures.mjs'; | ||
| 3 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 4 | 4 | import assert from 'assert'; | |
| 5 | 5 | import { spawn } from 'child_process'; | |
| 6 | 6 | import { execPath } from 'process'; | |
| 7 | 7 | ||
| 8 | - const fixtures = `${fixturesFileURL()}/`; | ||
| 8 | + const fixturesDir = `${fixtures.fileURL()}/`; | ||
| 9 | 9 | ||
| 10 | 10 | assert.strictEqual(import.meta.resolve('./test-esm-import-meta.mjs'), | |
| 11 | 11 | new URL('./test-esm-import-meta.mjs', import.meta.url).href); | |
@@ -18,23 +18,23 @@ assert.throws(() => { | |||
| 18 | 18 | }); | |
| 19 | 19 | assert.strictEqual( | |
| 20 | 20 | import.meta.resolve('../fixtures/empty-with-bom.txt'), | |
| 21 | - fixtures + 'empty-with-bom.txt'); | ||
| 22 | - assert.strictEqual(import.meta.resolve('../fixtures/'), fixtures); | ||
| 21 | + fixturesDir + 'empty-with-bom.txt'); | ||
| 22 | + assert.strictEqual(import.meta.resolve('../fixtures/'), fixturesDir); | ||
| 23 | 23 | assert.strictEqual( | |
| 24 | 24 | import.meta.resolve('../fixtures/', import.meta.url), | |
| 25 | - fixtures); | ||
| 25 | + fixturesDir); | ||
| 26 | 26 | assert.strictEqual( | |
| 27 | 27 | import.meta.resolve('../fixtures/', new URL(import.meta.url)), | |
| 28 | - fixtures); | ||
| 28 | + fixturesDir); | ||
| 29 | 29 | [[], {}, Symbol(), 0, 1, 1n, 1.1, () => {}, true, false].forEach((arg) => | |
| 30 | 30 | assert.throws(() => import.meta.resolve('../fixtures/', arg), { | |
| 31 | 31 | code: 'ERR_INVALID_ARG_TYPE', | |
| 32 | 32 | }) | |
| 33 | 33 | ); | |
| 34 | 34 | assert.strictEqual(import.meta.resolve('http://some-absolute/url'), 'http://some-absolute/url'); | |
| 35 | 35 | assert.strictEqual(import.meta.resolve('some://weird/protocol'), 'some://weird/protocol'); | |
| 36 | - assert.strictEqual(import.meta.resolve('baz/', fixtures), | ||
| 37 | - fixtures + 'node_modules/baz/'); | ||
| 36 | + assert.strictEqual(import.meta.resolve('baz/', fixturesDir), | ||
| 37 | + fixturesDir + 'node_modules/baz/'); | ||
| 38 | 38 | assert.deepStrictEqual( | |
| 39 | 39 | { ...await import('data:text/javascript,export default import.meta.resolve("http://some-absolute/url")') }, | |
| 40 | 40 | { default: 'http://some-absolute/url' }, | |
@@ -44,8 +44,8 @@ assert.deepStrictEqual( | |||
| 44 | 44 | { default: 'some://weird/protocol' }, | |
| 45 | 45 | ); | |
| 46 | 46 | assert.deepStrictEqual( | |
| 47 | - { ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${encodeURIComponent(JSON.stringify(fixtures))})`) }, | ||
| 48 | - { default: fixtures + 'node_modules/baz/' }, | ||
| 47 | + { ...await import(`data:text/javascript,export default import.meta.resolve("baz/", ${encodeURIComponent(JSON.stringify(fixturesDir))})`) }, | ||
| 48 | + { default: fixturesDir + 'node_modules/baz/' }, | ||
| 49 | 49 | ); | |
| 50 | 50 | assert.deepStrictEqual( | |
| 51 | 51 | { ...await import('data:text/javascript,export default import.meta.resolve("fs")') }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { spawnPromisified } from '../common/index.mjs'; | |
| 2 | - import * as fixtures from '../common/fixtures.js'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | 3 | import assert from 'node:assert'; | |
| 4 | 4 | import { execPath } from 'node:process'; | |
| 5 | 5 | import { describe, it } from 'node:test'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { spawnPromisified } from '../common/index.mjs'; | |
| 2 | - import { fileURL, path } from '../common/fixtures.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | 3 | import assert from 'assert'; | |
| 4 | 4 | import { execPath } from 'node:process'; | |
| 5 | 5 | import { describe, it } from 'node:test'; | |
@@ -9,8 +9,8 @@ describe('ESM: thenable loader hooks', { concurrency: !process.env.TEST_PARALLEL | |||
| 9 | 9 | it('should behave as a normal promise resolution', async () => { | |
| 10 | 10 | const { code, stderr } = await spawnPromisified(execPath, [ | |
| 11 | 11 | '--experimental-loader', | |
| 12 | - fileURL('es-module-loaders', 'thenable-load-hook.mjs').href, | ||
| 13 | - path('es-modules', 'test-esm-ok.mjs'), | ||
| 12 | + fixtures.fileURL('es-module-loaders', 'thenable-load-hook.mjs').href, | ||
| 13 | + fixtures.path('es-modules', 'test-esm-ok.mjs'), | ||
| 14 | 14 | ]); | |
| 15 | 15 | ||
| 16 | 16 | assert.strictEqual(code, 0); | |
@@ -20,8 +20,8 @@ describe('ESM: thenable loader hooks', { concurrency: !process.env.TEST_PARALLEL | |||
| 20 | 20 | it('should crash the node process rejection with an error', async () => { | |
| 21 | 21 | const { code, stderr } = await spawnPromisified(execPath, [ | |
| 22 | 22 | '--experimental-loader', | |
| 23 | - fileURL('es-module-loaders', 'thenable-load-hook-rejected.mjs').href, | ||
| 24 | - path('es-modules', 'test-esm-ok.mjs'), | ||
| 23 | + fixtures.fileURL('es-module-loaders', 'thenable-load-hook-rejected.mjs').href, | ||
| 24 | + fixtures.path('es-modules', 'test-esm-ok.mjs'), | ||
| 25 | 25 | ]); | |
| 26 | 26 | ||
| 27 | 27 | assert.notStrictEqual(code, 0); | |
@@ -32,8 +32,8 @@ describe('ESM: thenable loader hooks', { concurrency: !process.env.TEST_PARALLEL | |||
| 32 | 32 | it('should just reject without an error (but NOT crash the node process)', async () => { | |
| 33 | 33 | const { code, stderr } = await spawnPromisified(execPath, [ | |
| 34 | 34 | '--experimental-loader', | |
| 35 | - fileURL('es-module-loaders', 'thenable-load-hook-rejected-no-arguments.mjs').href, | ||
| 36 | - path('es-modules', 'test-esm-ok.mjs'), | ||
| 35 | + fixtures.fileURL('es-module-loaders', 'thenable-load-hook-rejected-no-arguments.mjs').href, | ||
| 36 | + fixtures.path('es-modules', 'test-esm-ok.mjs'), | ||
| 37 | 37 | ]); | |
| 38 | 38 | ||
| 39 | 39 | assert.notStrictEqual(code, 0); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { spawnPromisified } from '../common/index.mjs'; | |
| 2 | - import { fileURL, path } from '../common/fixtures.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | 3 | import assert from 'node:assert'; | |
| 4 | 4 | import { execPath } from 'node:process'; | |
| 5 | 5 | import { describe, it } from 'node:test'; | |
@@ -9,8 +9,8 @@ describe('ESM: loader with syntax error', { concurrency: !process.env.TEST_PARAL | |||
| 9 | 9 | it('should crash the node process', async () => { | |
| 10 | 10 | const { code, stderr } = await spawnPromisified(execPath, [ | |
| 11 | 11 | '--experimental-loader', | |
| 12 | - fileURL('es-module-loaders', 'syntax-error.mjs').href, | ||
| 13 | - path('print-error-message.js'), | ||
| 12 | + fixtures.fileURL('es-module-loaders', 'syntax-error.mjs').href, | ||
| 13 | + fixtures.path('print-error-message.js'), | ||
| 14 | 14 | ]); | |
| 15 | 15 | ||
| 16 | 16 | assert.match(stderr, /SyntaxError/); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments