-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (66 loc) · 2.29 KB
/
Makefile
File metadata and controls
92 lines (66 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ROOT = $(shell pwd)
NODE_BIN = $(ROOT)/node_modules/.bin
MOCHA_OPTIONS = --recursive --ui bdd --timeout 1000
.PHONY: \
init post-install \
test tape tape-esm mocha mocha-esm jest ava \
lint \
quality ci \
lock
.DEFAULT_GOAL: quality
# FIXME: "Error [ERR_REQUIRE_ESM]"
# ```
# /path/to/javascript-testing/test/tape/tape.mjs:1
# Error [ERR_REQUIRE_ESM]: Must use import to load ES module: file:///path/to/javascript-testing/test/tape/tape.mjs
# at Module.load (internal/modules/cjs/loader.js:599:32)
# at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
# at Function.Module._load (internal/modules/cjs/loader.js:530:3)
# at Module.require (internal/modules/cjs/loader.js:637:17)
# ```
# ... even in Node 8
# saw this before with an upgrade to esm@3.2.25
# https://github.com/standard-things/esm/issues/868
# does not help: https://github.com/standard-things/esm/issues/868#issuecomment-657965217
# it's likely that `esm` / `@std/esm` is just not meant for 'blended' projects
# abandonning, for now (╯°□°)╯︵ ┻━┻
init:
@mkdir -p $(ROOT)/build/mongodb
post-install: init
@node -r esm $(ROOT)/bin/post-install.mjs
test: tape mocha jest ava
# https://github.com/substack/tape
tape-cjs:
@NODE_ENV=test $(NODE_BIN)/tape 'test/bootstrap.js' 'test/tape/*.js'
tape-esm:
@NODE_ENV=test $(NODE_BIN)/tape -r esm 'test/bootstrap.js' 'test/tape/*.mjs'
# # FIXME: "Error [ERR_REQUIRE_ESM]"
# tape: tape-cjs tape-esm
tape: tape-cjs
# https://mochajs.org/#usage
mocha-cjs:
@NODE_ENV=test $(NODE_BIN)/mocha $(MOCHA_OPTIONS) --reporter nyan \
"$(ROOT)/test/bootstrap.js" "$(ROOT)/test/mocha/*.js"
mocha-esm:
@NODE_ENV=test $(NODE_BIN)/mocha $(MOCHA_OPTIONS) --reporter dot \
-r esm \
"$(ROOT)/test/bootstrap.js" "$(ROOT)/test/mocha/*.mjs"
# # FIXME: "Error [ERR_REQUIRE_ESM]"
# mocha: mocha-cjs mocha-esm
mocha: mocha-cjs
# https://jestjs.io/docs/en/cli
# @see package.json + { jest }
jest:
@NODE_ENV=test $(NODE_BIN)/jest --config jest.config.js
# TODO: jest-esm
# https://jestjs.io/docs/en/cli
# @see package.json + { ava }
ava:
@NODE_ENV=test $(NODE_BIN)/ava
# TODO: ava-esm
lint:
@$(NODE_BIN)/eslint src/ test/
@$(NODE_BIN)/eslint --ext '.mjs' src/ test/
quality: test lint
ci: test lint
lock:
@npm install --package-lock-only