@0xweb/hardhat 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +17 -3
- package/package.json +4 -2
- package/readme.md +3 -2
- package/.circleci/config.yml +0 -31
- package/src/config.ts +0 -13
- package/src/constants.ts +0 -2
- package/src/index.ts +0 -120
- package/src/types.ts +0 -4
- package/test/compile.spec.ts +0 -25
- package/test/config.js +0 -8
- package/test/fixtures/hardhat-project/0xweb.json +0 -10
- package/test/fixtures/hardhat-project/compile.js +0 -6
- package/test/fixtures/hardhat-project/contracts/Foo.sol +0 -19
- package/test/fixtures/hardhat-project/hardhat.config.js +0 -21
- package/test/fixtures/integration/compile.js +0 -8
- package/test/fixtures/integration/example.ts +0 -25
- package/test/fixtures/integration/foo/bar/Foo.sol +0 -19
- package/test/integration.spec.ts +0 -67
- package/typings/globals/assertion/index.d.ts +0 -159
- package/typings/globals/assertion/typings.json +0 -10
- package/typings/globals/atma-utest/index.d.ts +0 -53
- package/typings/globals/atma-utest/typings.json +0 -10
- package/typings/index.d.ts +0 -2
package/lib/index.js
CHANGED
|
@@ -80,6 +80,7 @@ exports.TASK_0xWEB_GENERATE = '0xweb:generate';
|
|
|
80
80
|
"use strict";
|
|
81
81
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82
82
|
const alot_1 = require("alot");
|
|
83
|
+
const path = require("path");
|
|
83
84
|
const task_names_1 = require("hardhat/builtin-tasks/task-names");
|
|
84
85
|
const config_1 = require("hardhat/config");
|
|
85
86
|
const config_2 = _src_config;
|
|
@@ -93,12 +94,23 @@ const taskArgsStore = { compileAll: false };
|
|
|
93
94
|
(0, config_1.task)(task_names_1.TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
94
95
|
.addOptionalParam('sources', 'Override the sources directory')
|
|
95
96
|
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
97
|
+
.addOptionalParam('watch', 'Re-runs compilation task on changes')
|
|
96
98
|
.setAction(async (compilationArgs, { run, config }, runSuper) => {
|
|
97
99
|
if (compilationArgs.sources) {
|
|
98
|
-
config.paths.sources = process.cwd()
|
|
100
|
+
config.paths.sources = path.join(process.cwd(), compilationArgs.sources);
|
|
99
101
|
}
|
|
100
102
|
if (compilationArgs.artifacts) {
|
|
101
|
-
config.paths.artifacts = process.cwd()
|
|
103
|
+
config.paths.artifacts = path.join(process.cwd(), compilationArgs.artifacts);
|
|
104
|
+
}
|
|
105
|
+
if (compilationArgs.watch != null) {
|
|
106
|
+
const directory = `file://${config.paths.sources}/`;
|
|
107
|
+
atma_io_1.Directory.watch(directory, async (...args) => {
|
|
108
|
+
console.log('XX', args);
|
|
109
|
+
await runSuper();
|
|
110
|
+
});
|
|
111
|
+
await runSuper();
|
|
112
|
+
await new Promise(resolve => { });
|
|
113
|
+
return;
|
|
102
114
|
}
|
|
103
115
|
await runSuper();
|
|
104
116
|
});
|
|
@@ -145,7 +157,9 @@ async function getCompiledAbis(config, compileSolOutput) {
|
|
|
145
157
|
name: artifactName,
|
|
146
158
|
sourceFile: 'file://' + artifactPerFile.file.absolutePath
|
|
147
159
|
};
|
|
148
|
-
})
|
|
160
|
+
})
|
|
161
|
+
.filter(x => x.sourceFile.includes('@openzeppelin') === false)
|
|
162
|
+
.toArray();
|
|
149
163
|
}).toArray();
|
|
150
164
|
}).toArray();
|
|
151
165
|
let namesHash = (0, alot_1.default)(emitedArtifacts).toDictionary(x => x.name);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xweb/hardhat",
|
|
3
3
|
"description": "Hardhat plugin for 0xweb",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Alex Kit",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"0xweb": "^0.9.25",
|
|
22
22
|
"alot": "^0.3.0",
|
|
23
|
+
"atma-io": "^1.2.65",
|
|
23
24
|
"memd": "^0.3.10"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
@@ -60,7 +61,8 @@
|
|
|
60
61
|
"alot",
|
|
61
62
|
"atma-io",
|
|
62
63
|
"0xweb",
|
|
63
|
-
"^hardhat"
|
|
64
|
+
"^hardhat",
|
|
65
|
+
"path"
|
|
64
66
|
],
|
|
65
67
|
"middlewares": {
|
|
66
68
|
"ts": [
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [
|
|
1
|
+
# [`0xWeb`](https://0xweb.org) plugin for [Hardhat](https://hardhat.org/)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
----
|
|
@@ -59,7 +59,7 @@ import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'
|
|
|
59
59
|
|
|
60
60
|
// automatically deploys the contract to hardhat chain
|
|
61
61
|
const deployer = new HardhatProvider();
|
|
62
|
-
const foo = await deployer.
|
|
62
|
+
const foo = await deployer.deployClass<Foo>(Foo, { arguments: [ 'Hello' ] });
|
|
63
63
|
|
|
64
64
|
// write
|
|
65
65
|
const tx = await foo.setName('Hello world')
|
|
@@ -95,5 +95,6 @@ const text = await foo.name();
|
|
|
95
95
|
|
|
96
96
|
- `npx hardhat compile --source /foo/bar/qux` - compiles solidity files which are located outside the `/contracts` folder
|
|
97
97
|
- `npx hardhat compile --artifacts /dist` - set custom folder for artifacts (ABI JSONs and TS contracts)
|
|
98
|
+
- `npx hardhat compile --watch` - Compile the sources and waits to recompile on changes
|
|
98
99
|
|
|
99
100
|
----
|
package/.circleci/config.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# See: https://circleci.com/docs/2.0/configuration-reference
|
|
2
|
-
version: 2.1
|
|
3
|
-
|
|
4
|
-
orbs:
|
|
5
|
-
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
|
|
6
|
-
node: circleci/node@5.0.2
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build-and-test:
|
|
10
|
-
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
|
|
11
|
-
# https://circleci.com/developer/images/image/cimg/node
|
|
12
|
-
docker:
|
|
13
|
-
- image: cimg/node:18.0.0
|
|
14
|
-
steps:
|
|
15
|
-
- checkout
|
|
16
|
-
- node/install-packages:
|
|
17
|
-
pkg-manager: npm
|
|
18
|
-
- run:
|
|
19
|
-
name: Build Project
|
|
20
|
-
command: npm run build
|
|
21
|
-
- run:
|
|
22
|
-
name: Run tests
|
|
23
|
-
command: npm run test
|
|
24
|
-
|
|
25
|
-
workflows:
|
|
26
|
-
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
|
|
27
|
-
# CircleCI will run this workflow on every commit.
|
|
28
|
-
# https://circleci.com/docs/2.0/configuration-reference/#workflows
|
|
29
|
-
TestRunner:
|
|
30
|
-
jobs:
|
|
31
|
-
- build-and-test
|
package/src/config.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HardhatConfig } from 'hardhat/types'
|
|
2
|
-
|
|
3
|
-
import { _0xwebConfig } from './types'
|
|
4
|
-
|
|
5
|
-
export function resolveConfig(config: HardhatConfig): _0xwebConfig {
|
|
6
|
-
const defaultConfig: _0xwebConfig = {
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
...defaultConfig,
|
|
11
|
-
...(config['0xweb'] ?? {}),
|
|
12
|
-
};
|
|
13
|
-
}
|
package/src/constants.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import alot from 'alot'
|
|
2
|
-
import { TASK_CLEAN, TASK_COMPILE, TASK_COMPILE_SOLIDITY_COMPILE_JOBS } from 'hardhat/builtin-tasks/task-names'
|
|
3
|
-
import { extendConfig, subtask, task } from 'hardhat/config'
|
|
4
|
-
import { resolveConfig } from './config'
|
|
5
|
-
import { TASK_0xWEB, TASK_0xWEB_GENERATE } from './constants'
|
|
6
|
-
import { Directory } from 'atma-io'
|
|
7
|
-
import { App } from '0xweb'
|
|
8
|
-
|
|
9
|
-
const taskArgsStore = { compileAll: false }
|
|
10
|
-
|
|
11
|
-
extendConfig((config) => {
|
|
12
|
-
config['0xweb'] = resolveConfig(config)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
task(TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
16
|
-
.addOptionalParam('sources', 'Override the sources directory')
|
|
17
|
-
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
18
|
-
.setAction(async (compilationArgs, { run, config }, runSuper) => {
|
|
19
|
-
|
|
20
|
-
if (compilationArgs.sources) {
|
|
21
|
-
config.paths.sources = process.cwd() + compilationArgs.sources;
|
|
22
|
-
}
|
|
23
|
-
if (compilationArgs.artifacts) {
|
|
24
|
-
config.paths.artifacts = process.cwd() + compilationArgs.artifacts;
|
|
25
|
-
}
|
|
26
|
-
await runSuper()
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
subtask(TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts')
|
|
30
|
-
.setAction(async (taskArgs, { run }, runSuper) => {
|
|
31
|
-
const compileSolOutput = await runSuper(taskArgs)
|
|
32
|
-
await run(TASK_0xWEB_GENERATE, { compileSolOutput })
|
|
33
|
-
return compileSolOutput
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
subtask(TASK_0xWEB_GENERATE)
|
|
37
|
-
.setAction(async (a, b) => {
|
|
38
|
-
let { compileSolOutput } = a;
|
|
39
|
-
let { config, artifacts } = b;
|
|
40
|
-
|
|
41
|
-
const contracts = await getCompiledAbis(config, compileSolOutput)
|
|
42
|
-
|
|
43
|
-
const app = new App();
|
|
44
|
-
await alot(contracts)
|
|
45
|
-
.forEachAsync(async (contract, i) => {
|
|
46
|
-
console.log(`Generation ${contract.name}(${contract.path}) ${i}/${contracts.length}`);
|
|
47
|
-
await app.execute([`install`, `${contract.path}`, '--name', contract.name, '--chain', 'hardhat'])
|
|
48
|
-
})
|
|
49
|
-
.toArrayAsync({ threads: 1 })
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
task(TASK_0xWEB, 'Generate 0xWeb classes for compiled contracts')
|
|
53
|
-
.setAction(async (_, { run }) => {
|
|
54
|
-
taskArgsStore.compileAll = true
|
|
55
|
-
await run(TASK_COMPILE, { quiet: true })
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
task(TASK_CLEAN, 'Clears the cache and deletes all artifacts')
|
|
59
|
-
.setAction(async ({ global }: { global: boolean }, { config }, runSuper) => {
|
|
60
|
-
if (global) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const dir = `/0xweb/hardhat/`;
|
|
64
|
-
if (await Directory.existsAsync(dir)) {
|
|
65
|
-
await Directory.removeAsync(dir);
|
|
66
|
-
}
|
|
67
|
-
await runSuper()
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
async function getCompiledAbis(config: { paths: { artifacts: string } }, compileSolOutput: {
|
|
71
|
-
artifactsEmittedPerJob: {
|
|
72
|
-
artifactsEmittedPerFile: {
|
|
73
|
-
file: {
|
|
74
|
-
sourceName: string
|
|
75
|
-
absolutePath: string
|
|
76
|
-
}
|
|
77
|
-
artifactsEmitted: string[]
|
|
78
|
-
}[]
|
|
79
|
-
}[]
|
|
80
|
-
}): Promise<{ name: string, path: string }[]> {
|
|
81
|
-
|
|
82
|
-
const emitedArtifacts = alot(compileSolOutput.artifactsEmittedPerJob).mapMany((a) => {
|
|
83
|
-
return alot(a.artifactsEmittedPerFile).mapMany((artifactPerFile) => {
|
|
84
|
-
return alot(artifactPerFile.artifactsEmitted).map((artifactName) => {
|
|
85
|
-
return {
|
|
86
|
-
name: artifactName,
|
|
87
|
-
sourceFile: 'file://' + artifactPerFile.file.absolutePath
|
|
88
|
-
};
|
|
89
|
-
}).toArray();
|
|
90
|
-
}).toArray();
|
|
91
|
-
}).toArray();
|
|
92
|
-
|
|
93
|
-
let namesHash = alot(emitedArtifacts).toDictionary(x => x.name);
|
|
94
|
-
let files = await Directory.readFilesAsync(`file://${config.paths.artifacts}/`, '**.json');
|
|
95
|
-
let compileAll = taskArgsStore.compileAll;
|
|
96
|
-
let arr = files
|
|
97
|
-
.map(file => {
|
|
98
|
-
let path = file.uri.toString();
|
|
99
|
-
|
|
100
|
-
let match = /(?<name>[^\\\/]+)\.sol[\\\/]/.exec(path);
|
|
101
|
-
if (match == null) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
let name = match.groups.name;
|
|
105
|
-
if (compileAll !== true && name in namesHash === false) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
if (new RegExp(`${name}\\.json$`).test(path) === false) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
name: name,
|
|
114
|
-
path: path
|
|
115
|
-
};
|
|
116
|
-
})
|
|
117
|
-
.filter(Boolean);
|
|
118
|
-
|
|
119
|
-
return arr;
|
|
120
|
-
}
|
package/src/types.ts
DELETED
package/test/compile.spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { run } from 'shellbee'
|
|
2
|
-
import { File, Directory } from 'atma-io'
|
|
3
|
-
|
|
4
|
-
const PROJ = `./test/fixtures/hardhat-project/`;
|
|
5
|
-
const PROJ_ARTIFACTS = `${PROJ}/artifacts/`;
|
|
6
|
-
const PROJ_0xWEB = `${PROJ}/0xweb/`;
|
|
7
|
-
UTest({
|
|
8
|
-
async $before () {
|
|
9
|
-
if (Directory.exists(PROJ_ARTIFACTS)) {
|
|
10
|
-
await Directory.removeAsync(PROJ_ARTIFACTS);
|
|
11
|
-
}
|
|
12
|
-
if (Directory.exists(PROJ_0xWEB)) {
|
|
13
|
-
await Directory.removeAsync(PROJ_0xWEB);
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
async 'should compile the project' () {
|
|
17
|
-
|
|
18
|
-
let result = await run({
|
|
19
|
-
command: 'node --openssl-legacy-provider compile.js',
|
|
20
|
-
cwd: PROJ
|
|
21
|
-
});
|
|
22
|
-
let content = await File.readAsync(`${PROJ_0xWEB}/hardhat/Foo/Foo.ts`, { skipHooks: true });
|
|
23
|
-
has_(content, 'class Foo extends ContractBase');
|
|
24
|
-
}
|
|
25
|
-
})
|
package/test/config.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
pragma solidity ^0.8.2;
|
|
2
|
-
|
|
3
|
-
contract Foo {
|
|
4
|
-
string public name;
|
|
5
|
-
event Updated (string newName);
|
|
6
|
-
|
|
7
|
-
constructor(string memory _name) {
|
|
8
|
-
name = _name;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function setName(string memory _name) public {
|
|
12
|
-
name = _name;
|
|
13
|
-
emit Updated(name);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getName () public view returns (string memory) {
|
|
17
|
-
return name;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require("@nomiclabs/hardhat-web3");
|
|
3
|
-
require("@nomiclabs/hardhat-waffle");
|
|
4
|
-
require('../../../lib/index');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
solidity: {
|
|
8
|
-
version: "0.8.2",
|
|
9
|
-
settings: {
|
|
10
|
-
optimizer: {
|
|
11
|
-
enabled: true,
|
|
12
|
-
runs: 200
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
networks: {
|
|
17
|
-
hardhat: {
|
|
18
|
-
chainId: 1337
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Config } from '@dequanto/Config';
|
|
2
|
-
import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider';
|
|
3
|
-
import { Foo } from '@0xweb/hardhat/Foo/Foo';
|
|
4
|
-
|
|
5
|
-
(async function () {
|
|
6
|
-
|
|
7
|
-
await Config.fetch()
|
|
8
|
-
|
|
9
|
-
const provider = new HardhatProvider();
|
|
10
|
-
const foo = await provider.resolve<Foo>(Foo, 'Lorem');
|
|
11
|
-
|
|
12
|
-
'> Get initial value'
|
|
13
|
-
let name = await foo.getName();
|
|
14
|
-
console.log(`First:`, name);
|
|
15
|
-
|
|
16
|
-
'> Submit value'
|
|
17
|
-
let tx = await foo.setName(provider.deployer(), 'ResetLorem');
|
|
18
|
-
await tx.wait();
|
|
19
|
-
|
|
20
|
-
'> Get new value'
|
|
21
|
-
name = await foo.getName();
|
|
22
|
-
console.log(`Second:`, name);
|
|
23
|
-
|
|
24
|
-
process.exit();
|
|
25
|
-
}());
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
pragma solidity ^0.8.2;
|
|
2
|
-
|
|
3
|
-
contract Foo {
|
|
4
|
-
string public name;
|
|
5
|
-
event Updated (string newName);
|
|
6
|
-
|
|
7
|
-
constructor(string memory _name) {
|
|
8
|
-
name = _name;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function setName(string memory _name) public {
|
|
12
|
-
name = _name;
|
|
13
|
-
emit Updated(name);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getName () public view returns (string memory) {
|
|
17
|
-
return name;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/test/integration.spec.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { run } from 'shellbee'
|
|
2
|
-
import { File, Directory } from 'atma-io'
|
|
3
|
-
import alot from 'alot';
|
|
4
|
-
|
|
5
|
-
const PROJ = `./test/fixtures/integration/`;
|
|
6
|
-
const PROJ_ARTIFACTS = `${PROJ}/artifacts/`;
|
|
7
|
-
const PROJ_0xWEB = `${PROJ}/0xweb/`;
|
|
8
|
-
const PROJ_DEQUANTO = `${PROJ}/dequanto/`;
|
|
9
|
-
UTest({
|
|
10
|
-
$config: {
|
|
11
|
-
timeout: 1000 * 60 * 15
|
|
12
|
-
},
|
|
13
|
-
async $before () {
|
|
14
|
-
let clean = [
|
|
15
|
-
PROJ_ARTIFACTS,
|
|
16
|
-
PROJ_0xWEB,
|
|
17
|
-
PROJ_DEQUANTO,
|
|
18
|
-
`${PROJ}/node_modules/`,
|
|
19
|
-
`${PROJ}/package.json`,
|
|
20
|
-
`${PROJ}/hardhat.config.js`,
|
|
21
|
-
];
|
|
22
|
-
await alot(clean).forEachAsync(async path => {
|
|
23
|
-
const Ctor = /\.\w+$/.test(path) ? File : Directory;
|
|
24
|
-
if (await Ctor.existsAsync(path)) {
|
|
25
|
-
await Ctor.removeAsync(path);
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
},
|
|
29
|
-
async $after () {
|
|
30
|
-
await Directory.removeAsync(`${PROJ}/.git/`);
|
|
31
|
-
await File.removeAsync(`${PROJ}/.gitmodules`);
|
|
32
|
-
},
|
|
33
|
-
async 'should initialize and compile the project' () {
|
|
34
|
-
let { stdout } = await run({
|
|
35
|
-
command: `0xweb -v`,
|
|
36
|
-
silent: true
|
|
37
|
-
});
|
|
38
|
-
let has0xWeb = /0xweb@\d+\.\d+\.\d+/.test(stdout.join('\n'));
|
|
39
|
-
if (has0xWeb === false) {
|
|
40
|
-
await run({
|
|
41
|
-
command: 'npm i 0xweb -g',
|
|
42
|
-
cwd: PROJ
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
await run({
|
|
46
|
-
command: '0xweb init --hardhat',
|
|
47
|
-
cwd: PROJ
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
await File.replaceAsync(`${PROJ}/hardhat.config.js`, '@0xweb/hardhat', '../../../lib/index');
|
|
51
|
-
|
|
52
|
-
await run({
|
|
53
|
-
command: 'node --openssl-legacy-provider compile.js',
|
|
54
|
-
cwd: PROJ
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
let { stdout } = await run({
|
|
59
|
-
command: 'npx atma --openssl-legacy-provider run example.ts',
|
|
60
|
-
cwd: PROJ
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
has_(stdout.join('\n'), /First: Lorem/g);
|
|
64
|
-
has_(stdout.join('\n'), /Second: ResetLorem/g);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
})
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
// Generated by typings
|
|
2
|
-
// Source: https://raw.githubusercontent.com/atmajs/assertion/master/types/assertion.d.ts
|
|
3
|
-
declare module "assertion" {
|
|
4
|
-
export = assert;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare var assert: assertion.IAssert
|
|
8
|
-
|
|
9
|
-
declare var eq_: assertion.equal
|
|
10
|
-
declare var notEq_: assertion.notEqual
|
|
11
|
-
declare var lt_: assertion.lessThan
|
|
12
|
-
declare var lte_: assertion.lessThanOrEqual
|
|
13
|
-
declare var gt_: assertion.greaterThan
|
|
14
|
-
declare var gte_: assertion.greaterThanOrEqual
|
|
15
|
-
declare var deepEq_: assertion.deepEqual
|
|
16
|
-
declare var notDeepEq_: assertion.notDeepEqual
|
|
17
|
-
declare var has_: assertion.has
|
|
18
|
-
declare var hasNot_: assertion.hasNot
|
|
19
|
-
declare var is_: assertion.is
|
|
20
|
-
declare var isNot_: assertion.isNot
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
declare namespace assertion {
|
|
24
|
-
interface IAssert {
|
|
25
|
-
(expression: boolean, message: string): void
|
|
26
|
-
equal: equal
|
|
27
|
-
notEqual: notEqual
|
|
28
|
-
strictEqual: strictEqual
|
|
29
|
-
notStrictEqual: notStrictEqual
|
|
30
|
-
throws: throws
|
|
31
|
-
notThrows: notThrows
|
|
32
|
-
ifError: ifError
|
|
33
|
-
lessThan: lessThan
|
|
34
|
-
lessThanOrEqual: lessThanOrEqual
|
|
35
|
-
|
|
36
|
-
greaterThan: greaterThan
|
|
37
|
-
greaterThanOrEqual: greaterThanOrEqual
|
|
38
|
-
deepEqual: deepEqual
|
|
39
|
-
notDeepEqual: notDeepEqual
|
|
40
|
-
has: has
|
|
41
|
-
hasNot: hasNot
|
|
42
|
-
is: is
|
|
43
|
-
|
|
44
|
-
on: on
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* string: Await Name for better logging
|
|
48
|
-
* number: expectation count
|
|
49
|
-
* object: binded content
|
|
50
|
-
* function: wrap any function
|
|
51
|
-
*/
|
|
52
|
-
await (
|
|
53
|
-
arg1?: string | number | Function | object,
|
|
54
|
-
arg2?: string | number | Function | object,
|
|
55
|
-
arg3?: string | number | Function | object,
|
|
56
|
-
arg4?: string | number | Function | object,
|
|
57
|
-
): Function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* string: Await Name for better logging
|
|
62
|
-
* number: expectation count, default is `1`
|
|
63
|
-
* object: binded content
|
|
64
|
-
* function: wrap any function
|
|
65
|
-
*/
|
|
66
|
-
avoid (
|
|
67
|
-
arg1?: string | number | Function | object,
|
|
68
|
-
arg2?: string | number | Function | object,
|
|
69
|
-
arg3?: string | number | Function | object,
|
|
70
|
-
arg4?: string | number | Function | object,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
interface equal {
|
|
74
|
-
(a: any, b: any, message?: string)
|
|
75
|
-
}
|
|
76
|
-
interface notEqual {
|
|
77
|
-
(a: any, b: any, message?: string)
|
|
78
|
-
}
|
|
79
|
-
interface strictEqual {
|
|
80
|
-
(a: any, b: any, message?: string)
|
|
81
|
-
}
|
|
82
|
-
interface notStrictEqual {
|
|
83
|
-
(a: any, b: any, message?: string)
|
|
84
|
-
}
|
|
85
|
-
interface throws {
|
|
86
|
-
(a: Function, message?: string): Error
|
|
87
|
-
}
|
|
88
|
-
interface notThrows {
|
|
89
|
-
(a: Function, message?: string): Error
|
|
90
|
-
}
|
|
91
|
-
interface ifError {
|
|
92
|
-
(a: any, message?: string)
|
|
93
|
-
}
|
|
94
|
-
interface lessThan {
|
|
95
|
-
(a: any, b: any, message?: string)
|
|
96
|
-
}
|
|
97
|
-
interface lessThanOrEqual {
|
|
98
|
-
(a: any, b: any, message?: string)
|
|
99
|
-
}
|
|
100
|
-
interface greaterThan {
|
|
101
|
-
(a: any, b: any, message?: string)
|
|
102
|
-
}
|
|
103
|
-
interface greaterThanOrEqual {
|
|
104
|
-
(a: any, b: any, message?: string)
|
|
105
|
-
}
|
|
106
|
-
interface deepEqual {
|
|
107
|
-
(a: any, b: any, message?: string)
|
|
108
|
-
}
|
|
109
|
-
interface notDeepEqual {
|
|
110
|
-
(a: any, b: any, message?: string)
|
|
111
|
-
}
|
|
112
|
-
interface has {
|
|
113
|
-
(a: any, b: any, message?: string)
|
|
114
|
-
}
|
|
115
|
-
interface is {
|
|
116
|
-
(a: any, b:
|
|
117
|
-
'String' |
|
|
118
|
-
'Number' |
|
|
119
|
-
'Null' |
|
|
120
|
-
'Undefined' |
|
|
121
|
-
'Function' |
|
|
122
|
-
'RegExp' |
|
|
123
|
-
'Date' |
|
|
124
|
-
'Object' |
|
|
125
|
-
'CustomEvent' |
|
|
126
|
-
null |
|
|
127
|
-
any, message?: string)
|
|
128
|
-
}
|
|
129
|
-
interface isNot {
|
|
130
|
-
(a: any, b:
|
|
131
|
-
'String' |
|
|
132
|
-
'Number' |
|
|
133
|
-
'Null' |
|
|
134
|
-
'Undefined' |
|
|
135
|
-
'Function' |
|
|
136
|
-
'RegExp' |
|
|
137
|
-
'Date' |
|
|
138
|
-
'Object' |
|
|
139
|
-
'CustomEvent' |
|
|
140
|
-
null |
|
|
141
|
-
any, message?: string)
|
|
142
|
-
}
|
|
143
|
-
interface hasNot {
|
|
144
|
-
(a: any, b: any, message?: string)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/** Notice: when `fail` callback is defined the assertion doesn`t throw any error */
|
|
149
|
-
interface on {
|
|
150
|
-
(event: 'start' | 'fail' | 'success', callback: (error?: AssertionError) => void)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
interface AssertionError extends Error {
|
|
155
|
-
actual: any
|
|
156
|
-
expected: any
|
|
157
|
-
operator: string
|
|
158
|
-
}
|
|
159
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Generated by typings
|
|
2
|
-
// Source: https://raw.githubusercontent.com/atmajs/utest/master/types/index.d.ts
|
|
3
|
-
declare module "atma-utest" {
|
|
4
|
-
export = UTest;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare var UTest: IUtest;
|
|
8
|
-
|
|
9
|
-
declare interface IUtest {
|
|
10
|
-
(definition: IUTestDefinition): void
|
|
11
|
-
|
|
12
|
-
domtest: IDomTest
|
|
13
|
-
request (url, method, headers, data, callback)
|
|
14
|
-
server: {
|
|
15
|
-
render (template: string, ...args)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
benchmark (model: IUTestDefinition)
|
|
19
|
-
benchmarkVersions (model: IUTestDefinition)
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface IDomTest {
|
|
24
|
-
(subject: HTMLElement | JQuery | any, testMarkup: string | any): PromiseLike<any>
|
|
25
|
-
use (astName: string): IDomTest
|
|
26
|
-
process (subject: HTMLElement | JQuery | any, testMarkup: string | any): PromiseLike<any>
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface IUTestDefinition {
|
|
30
|
-
$config?: {
|
|
31
|
-
timeout?: number
|
|
32
|
-
errorableCallbacks?: boolean
|
|
33
|
-
breakOnError?: boolean
|
|
34
|
-
|
|
35
|
-
'http.config'?: any
|
|
36
|
-
'http.eval'?: string
|
|
37
|
-
'http.include'?: any
|
|
38
|
-
'http.service'?: any
|
|
39
|
-
'http.process'?: any
|
|
40
|
-
'util.process'?: any
|
|
41
|
-
}
|
|
42
|
-
$before?: (done?: Function) => void | PromiseLike<any>
|
|
43
|
-
$after?: (done?: Function) => void | PromiseLike<any>
|
|
44
|
-
$teardown?: (done?: Function) => void | PromiseLike<any>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[key: string]: ITestCase | IUTestDefinition | any
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface ITestCase {
|
|
52
|
-
(done?: Function, ...args: any[]): void | PromiseLike<any> | any
|
|
53
|
-
}
|
package/typings/index.d.ts
DELETED