Skip to content

Commit 1863e74

Browse files
committed
wut
1 parent 4caac0b commit 1863e74

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
import { test, module } from 'qunit';
22
import { assert } from '@ember/debug';
3+
import { DEBUG } from '@glimmer/env';
4+
import { isDevelopingApp, isTesting } from '@embroider/macros';
35

46
module('debug utils remain in the build', function () {
5-
test('debug utils work in tests', function(qAssert) {
7+
test('assert', function(qAssert) {
8+
// If we get the build mode wrong, e.g.: `NODE_ENV` != 'development'
9+
// then the assert won't exist, causing qAssert to not detect a thrown Error
610
qAssert.throws(() => {
7-
// If we get the build mode wrong, e.g.: `NODE_ENV` != 'development'
8-
// then the assert will be stripped and qAssert will not detect an error being thrown
9-
assert('it works', false);
10-
}, 'it works');
11+
assert('should throw');
12+
}, /should throw/, `The error "should throw" is thrown`);
13+
14+
});
15+
16+
test('DEBUG', function (assert) {
17+
if (DEBUG) {
18+
assert.step('DEBUG');
19+
}
20+
21+
assert.verifySteps(['DEBUG']);
22+
});
23+
24+
test('isTesting', function (assert) {
25+
assert.strictEqual(isTesting(), true, `isTesting() === true`);
26+
});
27+
28+
test('isDevelopingApp', function (assert) {
29+
assert.strictEqual(isDevelopingApp(), true, `isDevelopingApp() === true`);
1130
});
1231
});

tests/smoke-tests/defaults.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
146146

147147
expect(testResult.exitCode).toEqual(0);
148148

149+
expect(testResult.stdout).includes('debug utils remain in the build: assert');
150+
expect(testResult.stdout).includes('debug utils remain in the build: DEBUG');
149151
expect(testResult.stdout).includes(
150-
`# tests 3
151-
# pass 3
152+
`# tests 4
153+
# pass 4
152154
# skip 0
153155
# todo 0
154156
# fail 0

0 commit comments

Comments
 (0)