-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path02-test.js
More file actions
executable file
·49 lines (40 loc) · 1.41 KB
/
02-test.js
File metadata and controls
executable file
·49 lines (40 loc) · 1.41 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
#!/usr/bin/env node
import { Logger } from './util/logger.js';
import FILE_PATHS from './util/file-paths.js';
const logger = new Logger();
await logger.init();
async function step02Test() {
await logger.logScriptBegin('test');
await logger.logSection('Run test suite', logger.f.italic('npx hardhat test'));
await logger.loggerJumpToFileLine(FILE_PATHS.counterTest);
await logger.logProcess('npx hardhat test');
await logger.log('Test completed!');
await logger.logInfoBox(
'What have we accomplished?',
`
1. Run mocha, via hardhat, using the Counter.test.js file as the specification.
2. Observe the outputs produced by mocha:
- A list of tests with "✔" next to each passing one
- A table showing gas consumption for smart contract deployment and invocation transactions.
`,
);
}
process.once('SIGINT', async () => {
await logger.logError('test', 'sigint');
});
process.once('SIGTERM', async () => {
await logger.logError('test', 'sigterm');
});
step02Test().then(async () => {
await logger.logScriptEnd('test');
console.log('To continue, run the following command for the next step:\n./03-deploy.js');
}).catch(async (err) => {
if (err.stdout || err.stderr) {
await logger.logError('test', err.message);
console.log(err.stdout);
console.log(err.stderr);
} else {
await logger.logError('test');
console.log(err);
}
});