Skip to content

Commit 17e3d39

Browse files
committed
put tests into relevant directories
1 parent 14b1cdd commit 17e3d39

19 files changed

+53
-53
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "Intercept imports in Node.js",
55
"main": "index.js",
66
"scripts": {
7-
"test": "c8 --check-coverage --lines 100 imhotap --runner test/runtest --files test/*.*js",
8-
"coverage": "c8 --reporter html imhotap --runner test/runtest --files test/*.*js && echo '\nNow open coverage/index.html\n'"
7+
"test": "c8 --check-coverage --lines 100 imhotap --runner test/runtest --files test/{hook,low-level}/*.*js",
8+
"coverage": "c8 --reporter html imhotap --runner test/runtest --files test/{hook,low-level}/*.*js && echo '\nNow open coverage/index.html\n'"
99
},
1010
"repository": {
1111
"type": "git",

test/hook-dynamic-import-default.js renamed to test/hook/dynamic-import-default.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
const Hook = require('../index.js')
5+
const Hook = require('../../index.js')
66
const { strictEqual } = require('assert')
77

88
Hook((exports, name) => {
@@ -21,8 +21,8 @@ Hook((exports, name) => {
2121
})
2222

2323
;(async () => {
24-
const { default: barMjs } = await import('./fixtures/something.mjs')
25-
const { default: barJs } = await import('./fixtures/something.js')
24+
const { default: barMjs } = await import('../fixtures/something.mjs')
25+
const { default: barJs } = await import('../fixtures/something.js')
2626

2727
strictEqual(barMjs(), 57)
2828
strictEqual(barJs(), 57)

test/hook-dynamic-import-default.mjs renamed to test/hook/dynamic-import-default.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
5+
import Hook from '../../index.js'
66
import { strictEqual } from 'assert'
77

88
Hook((exports, name) => {
@@ -15,8 +15,8 @@ Hook((exports, name) => {
1515
})
1616

1717
;(async () => {
18-
const { default: barMjs } = await import('./fixtures/something.mjs')
19-
const { default: barJs } = await import('./fixtures/something.js')
18+
const { default: barMjs } = await import('../fixtures/something.mjs')
19+
const { default: barJs } = await import('../fixtures/something.js')
2020

2121
strictEqual(barMjs(), 57)
2222
strictEqual(barJs(), 57)

test/hook-dynamic-import.js renamed to test/hook/dynamic-import.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
const Hook = require('../index.js')
5+
const Hook = require('../../index.js')
66
const { strictEqual } = require('assert')
77

88
Hook((exports, name) => {
@@ -15,8 +15,8 @@ Hook((exports, name) => {
1515
})
1616

1717
;(async () => {
18-
const { foo: fooMjs } = await import('./fixtures/something.mjs')
19-
const { foo: fooJs } = await import('./fixtures/something.js')
18+
const { foo: fooMjs } = await import('../fixtures/something.mjs')
19+
const { foo: fooJs } = await import('../fixtures/something.js')
2020
const { freemem } = await import('os')
2121

2222
strictEqual(fooMjs, 57)

test/hook-dynamic-import.mjs renamed to test/hook/dynamic-import.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
5+
import Hook from '../../index.js'
66
import { strictEqual } from 'assert'
77

88
Hook((exports, name) => {
@@ -15,8 +15,8 @@ Hook((exports, name) => {
1515
})
1616

1717
;(async () => {
18-
const { foo: fooMjs } = await import('./fixtures/something.mjs')
19-
const { foo: fooJs } = await import('./fixtures/something.js')
18+
const { foo: fooMjs } = await import('../fixtures/something.mjs')
19+
const { foo: fooJs } = await import('../fixtures/something.js')
2020
const { freemem } = await import('os')
2121

2222
strictEqual(fooMjs, 57)

test/hook-remove.mjs renamed to test/hook/remove.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
5+
import Hook from '../../index.js'
66
import { strictEqual } from 'assert'
77

88
const hook = new Hook((exports, name) => {
@@ -12,11 +12,11 @@ const hook = new Hook((exports, name) => {
1212
})
1313

1414
;(async () => {
15-
const { foo: fooMjs } = await import('./fixtures/something.mjs')
15+
const { foo: fooMjs } = await import('../fixtures/something.mjs')
1616

1717
hook.unhook()
1818

19-
const { foo: fooJs } = await import('./fixtures/something.js')
19+
const { foo: fooJs } = await import('../fixtures/something.js')
2020

2121
strictEqual(fooMjs, 57)
2222
strictEqual(fooJs, 42)

test/hook-static-import-default.mjs renamed to test/hook/static-import-default.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
6-
import barMjs from './fixtures/something.mjs'
7-
import barJs from './fixtures/something.js'
5+
import Hook from '../../index.js'
6+
import barMjs from '../fixtures/something.mjs'
7+
import barJs from '../fixtures/something.js'
88
import { strictEqual } from 'assert'
99

1010
Hook((exports, name) => {

test/hook-static-import-disabled.mjs renamed to test/hook/static-import-disabled.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
6-
import { foo as fooMjs } from './fixtures/something.mjs'
7-
import { foo as fooJs } from './fixtures/something.js'
5+
import Hook from '../../index.js'
6+
import { foo as fooMjs } from '../fixtures/something.mjs'
7+
import { foo as fooJs } from '../fixtures/something.js'
88
import { strictEqual, fail } from 'assert'
99

1010
Hook(() => {

test/hook-static-import-package-internals-enabled.mjs renamed to test/hook/static-import-package-internals-enabled.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Hook from '../index.js'
1+
import Hook from '../../index.js'
22
import { Report } from 'c8/index.js'
33
import path from 'path'
44
import { fileURLToPath } from 'url'
55
import { strictEqual } from 'assert'
66

7-
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', 'c8')
7+
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'node_modules', 'c8')
88

99
Hook(['c8'], { internals: true }, (exports, name, baseDir) => {
1010
strictEqual(name, 'c8/index.js')

test/hook-static-import-package-internals.mjs renamed to test/hook/static-import-package-internals.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Hook from '../index.js'
1+
import Hook from '../../index.js'
22
import { Report } from 'c8/index.js'
33
import path from 'path'
44
import { fileURLToPath } from 'url'
55
import { strictEqual, notStrictEqual } from 'assert'
66

7-
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', 'c8')
7+
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'node_modules', 'c8')
88

99
Hook(['c8'], (exports, name, baseDir) => {
1010
strictEqual(name, 'c8')

test/hook-static-import-package.mjs renamed to test/hook/static-import-package.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Hook from '../index.js'
1+
import Hook from '../../index.js'
22
import { Report } from 'c8'
33
import path from 'path'
44
import { fileURLToPath } from 'url'
55
import { strictEqual } from 'assert'
66

7-
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', 'c8')
7+
const c8Dir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'node_modules', 'c8')
88

99
Hook(['c8'], (exports, name, baseDir) => {
1010
strictEqual(name, 'c8')

test/hook-static-import.mjs renamed to test/hook/static-import.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import Hook from '../index.js'
6-
import { foo as fooMjs } from './fixtures/something.mjs'
7-
import { foo as fooJs } from './fixtures/something.js'
5+
import Hook from '../../index.js'
6+
import { foo as fooMjs } from '../fixtures/something.mjs'
7+
import { foo as fooJs } from '../fixtures/something.js'
88
import { freemem } from 'os'
99
import { strictEqual } from 'assert'
1010

test/ll-dynamic-import-default.js renamed to test/low-level/dynamic-import-default.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
const { addHook } = require('../index.js')
5+
const { addHook } = require('../../index.js')
66
const { strictEqual } = require('assert')
77

88
addHook((name, exports) => {
@@ -15,8 +15,8 @@ addHook((name, exports) => {
1515
})
1616

1717
;(async () => {
18-
const { default: barMjs } = await import('./fixtures/something.mjs')
19-
const { default: barJs } = await import('./fixtures/something.js')
18+
const { default: barMjs } = await import('../fixtures/something.mjs')
19+
const { default: barJs } = await import('../fixtures/something.js')
2020

2121
strictEqual(barMjs(), 57)
2222
strictEqual(barJs(), 57)

test/ll-dynamic-import-default.mjs renamed to test/low-level/dynamic-import-default.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import { addHook } from '../index.js'
5+
import { addHook } from '../../index.js'
66
import { strictEqual } from 'assert'
77

88
addHook((name, exports) => {
@@ -15,8 +15,8 @@ addHook((name, exports) => {
1515
})
1616

1717
;(async () => {
18-
const { default: barMjs } = await import('./fixtures/something.mjs')
19-
const { default: barJs } = await import('./fixtures/something.js')
18+
const { default: barMjs } = await import('../fixtures/something.mjs')
19+
const { default: barJs } = await import('../fixtures/something.js')
2020

2121
strictEqual(barMjs(), 57)
2222
strictEqual(barJs(), 57)

test/ll-dynamic-import.js renamed to test/low-level/dynamic-import.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
const { addHook } = require('../index.js')
5+
const { addHook } = require('../../index.js')
66
const { strictEqual } = require('assert')
77

88
addHook((name, exports) => {
@@ -15,8 +15,8 @@ addHook((name, exports) => {
1515
})
1616

1717
;(async () => {
18-
const { foo: fooMjs } = await import('./fixtures/something.mjs')
19-
const { foo: fooJs } = await import('./fixtures/something.js')
18+
const { foo: fooMjs } = await import('../fixtures/something.mjs')
19+
const { foo: fooJs } = await import('../fixtures/something.js')
2020
const { freemem } = await import('os')
2121

2222
strictEqual(fooMjs, 57)

test/ll-remove.mjs renamed to test/low-level/remove.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import { addHook, removeHook } from '../index.js'
5+
import { addHook, removeHook } from '../../index.js'
66
import { strictEqual } from 'assert'
77

88
const hook = (name, exports) => {
@@ -14,11 +14,11 @@ const hook = (name, exports) => {
1414
addHook(hook)
1515

1616
;(async () => {
17-
const { foo: fooMjs } = await import('./fixtures/something.mjs')
17+
const { foo: fooMjs } = await import('../fixtures/something.mjs')
1818

1919
removeHook(hook)
2020

21-
const { foo: fooJs } = await import('./fixtures/something.js')
21+
const { foo: fooJs } = await import('../fixtures/something.js')
2222

2323
strictEqual(fooMjs, 57)
2424
strictEqual(fooJs, 42)

test/ll-static-import-default.mjs renamed to test/low-level/static-import-default.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import { addHook } from '../index.js'
6-
import barMjs from './fixtures/something.mjs'
7-
import barJs from './fixtures/something.js'
5+
import { addHook } from '../../index.js'
6+
import barMjs from '../fixtures/something.mjs'
7+
import barJs from '../fixtures/something.js'
88
import { strictEqual } from 'assert'
99

1010
addHook((name, exports) => {

test/ll-static-import-disabled.mjs renamed to test/low-level/static-import-disabled.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import { addHook } from '../index.js'
6-
import { foo as fooMjs } from './fixtures/something.mjs'
7-
import { foo as fooJs } from './fixtures/something.js'
5+
import { addHook } from '../../index.js'
6+
import { foo as fooMjs } from '../fixtures/something.mjs'
7+
import { foo as fooJs } from '../fixtures/something.js'
88
import { strictEqual, fail } from 'assert'
99

1010
addHook(() => {

test/ll-static-import.mjs renamed to test/low-level/static-import.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//
33
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
44

5-
import { addHook } from '../index.js'
6-
import { foo as fooMjs } from './fixtures/something.mjs'
7-
import { foo as fooJs } from './fixtures/something.js'
5+
import { addHook } from '../../index.js'
6+
import { foo as fooMjs } from '../fixtures/something.mjs'
7+
import { foo as fooJs } from '../fixtures/something.js'
88
import { freemem } from 'os'
99
import { strictEqual } from 'assert'
1010

0 commit comments

Comments
 (0)