Skip to content

Instantly share code, notes, and snippets.

@rubys
Created July 31, 2018 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubys/b79c692831b2a9a6dea4897c3d121f7b to your computer and use it in GitHub Desktop.
Save rubys/b79c692831b2a9a6dea4897c3d121f7b to your computer and use it in GitHub Desktop.
'use strict';
require('../common');
const assert = require('assert');
const { spawn } = require('child_process');
const input = `
import('path').then(
(path) => {process.stdout.write(path.delimiter)},
console.log
);
`.trim();
const node = process.argv[0];
const args = ['--experimental-modules'];
const subprocess = spawn(node, args);
let stdout = '';
let stderr = '';
subprocess.stdin.end(input);
subprocess.stdout.on('data', (data) => stdout += data);
subprocess.stderr.on('data', (data) => stderr += data);
subprocess.on('close', () => {
assert.strictEqual(stderr.replace(/.*ExperimentalWarning.*/, '').trim(), '');
assert.strictEqual(stdout.trim(), ':');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment