Update typescript template to follow some conventions (#42)

* Update default project to follow conventions
This commit is contained in:
Ross Brodbeck
2019-12-06 14:22:35 -05:00
committed by GitHub
parent 752ef589a8
commit 9cdc5b327a
16 changed files with 2823 additions and 1238 deletions

View File

@@ -3,25 +3,25 @@ import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'
test('throws invalid number', async() => {
const input = parseInt('foo', 10);
await expect(wait(input)).rejects.toThrow('milliseconds not a number');
});
test('throws invalid number', async () => {
const input = parseInt('foo', 10)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
})
test('wait 500 ms', async() => {
const start = new Date();
await wait(500);
const end = new Date();
var delta = Math.abs(end.getTime() - start.getTime());
expect(delta).toBeGreaterThan(450);
});
test('wait 500 ms', async () => {
const start = new Date()
await wait(500)
const end = new Date()
var delta = Math.abs(end.getTime() - start.getTime())
expect(delta).toBeGreaterThan(450)
})
// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500';
const ip = path.join(__dirname, '..', 'lib', 'main.js');
const options: cp.ExecSyncOptions = {
env: process.env
};
console.log(cp.execSync(`node ${ip}`, options).toString());
});
process.env['INPUT_MILLISECONDS'] = '500'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
}
console.log(cp.execSync(`node ${ip}`, options).toString())
})