0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/es-module/test-esm-json-cache.mjs
Guy Bedford c0437d2633 Revert "esm: remove experimental status from JSON modules"
This reverts commit ec8776da6f.

PR-URL: https://github.com/nodejs/node/pull/29754
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2019-10-08 21:18:04 -07:00

26 lines
930 B
JavaScript

// Flags: --experimental-modules --experimental-json-modules
import '../common/index.mjs';
import { strictEqual, deepStrictEqual } from 'assert';
import { createRequireFromPath as createRequire } from 'module';
import { fileURLToPath as fromURL } from 'url';
import mod from '../fixtures/es-modules/json-cache/mod.cjs';
import another from '../fixtures/es-modules/json-cache/another.cjs';
import test from '../fixtures/es-modules/json-cache/test.json';
const require = createRequire(fromURL(import.meta.url));
const modCjs = require('../fixtures/es-modules/json-cache/mod.cjs');
const anotherCjs = require('../fixtures/es-modules/json-cache/another.cjs');
const testCjs = require('../fixtures/es-modules/json-cache/test.json');
strictEqual(mod.one, 1);
strictEqual(another.one, 'zalgo');
strictEqual(test.one, 'it comes');
deepStrictEqual(mod, modCjs);
deepStrictEqual(another, anotherCjs);
deepStrictEqual(test, testCjs);