forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommonjs.test.cjs
More file actions
24 lines (22 loc) · 818 Bytes
/
commonjs.test.cjs
File metadata and controls
24 lines (22 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Only use native node.js API's and references to ./lib here, this file is not transpiled!
const assert = require('assert')
const cp = require('child_process')
const path = require('path')
describe('lib/cjs', function () {
it('should load via commonjs', function (done) {
const filename = path.join(__dirname, 'commonjsApp.cjs')
cp.exec('node ' + filename, function (error, result) {
assert.strictEqual(error, null)
assert.strictEqual(result, '2\n2i\n')
done()
})
})
it('should load numbers only via commonjs', function (done) {
const filename = path.join(__dirname, 'commonjsAppNumberOnly.cjs')
cp.exec('node ' + filename, function (error, result) {
assert.strictEqual(error, null)
assert.strictEqual(result, '2\nNaN\n2\n4\n7\n')
done()
})
})
})