Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giltayar authored and juergba committed Feb 3, 2021
1 parent 22544f9 commit 19ca1a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/integration/esm.spec.js
@@ -1,5 +1,7 @@
'use strict';
var run = require('./helpers').runMochaJSON;
var helpers = require('./helpers');
var run = helpers.runMochaJSON;
var runMochaAsync = helpers.runMochaAsync;
var utils = require('../../lib/utils');
var args =
+process.versions.node.split('.')[0] >= 13 ? [] : ['--experimental-modules'];
Expand Down Expand Up @@ -38,6 +40,14 @@ describe('esm', function() {
});
});

it('should show file location when there is a syntax error in the test', async function() {
var fixture = 'esm/syntax-error/esm-syntax-error.fixture.mjs';
const err = await runMochaAsync(fixture, args, {stdio: 'pipe'}).catch(
err => err
);
expect(err.output, 'to contain', 'SyntaxError').and('to contain', fixture);
});

it('should recognize esm files ending with .js due to package.json type flag', function(done) {
if (!utils.supportsEsModules(false)) return this.skip();

Expand Down
@@ -0,0 +1,3 @@
// This is intentionally a syntax error
it('should never run because of a syntax error here', => {
});

0 comments on commit 19ca1a4

Please sign in to comment.