Skip to content

Commit

Permalink
refactor: fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Feb 21, 2020
1 parent 1c1041f commit 48819a6
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
settings: {},
plugins: ['es'],
globals: {},
rules: {strict: 'off'},
overrides: [
{
files: ['index.js', 'import.js', 'tests/main.js'],
Expand Down
3 changes: 0 additions & 3 deletions fixtures/import-from-directory.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions tests/fixtures/import-from-directory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

// TODO: move to integration test

const importEsm = require('../..')

module.exports = importEsm('./bar.mjs')
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function testCheck() {
function testLoad() {
var promise
try {
promise = importEsm('../fixtures/foo.mjs')
promise = importEsm('./fixtures/foo.mjs')
} catch (error) {
console.log('`importEsm()` should never throws')
console.error(error)
Expand All @@ -82,13 +82,13 @@ function testLoad() {
equal(Object.prototype.toString.call(module), '[object Module]')
equal(module.name, 'foo')
})
importEsm('../fixtures/commonjs-package/name.mjs').then(function(module) {
importEsm('./fixtures/commonjs-package/name.mjs').then(function(module) {
equal(module.name, 'commonjs-package')
})
importEsm('../fixtures/module-package/name.mjs').then(function(module) {
importEsm('./fixtures/module-package/name.mjs').then(function(module) {
equal(module.name, 'module-package')
})
require('../fixtures/import-from-directory').then(function(module) {
require('./fixtures/import-from-directory').then(function(module) {
equal(module.name, 'bar')
})
} else {
Expand Down

0 comments on commit 48819a6

Please sign in to comment.