Skip to content

Commit 5585d9c

Browse files
authored
chore: migrate tests to Mocha/Chai (openapi-ts#842)
1 parent 41dee3e commit 5585d9c

File tree

99 files changed

+2848
-4896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2848
-4896
lines changed

.eslintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
example/*.ts
22
bin
3-
43
dist
54
examples
6-
tests
5+
**/generated/*
6+
**/expected/*
7+
**/specs/*

.eslintrc.js

-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@ module.exports = {
1111
"prettier/prettier": "error",
1212
"prefer-const": "off",
1313
},
14-
env: {
15-
jest: true,
16-
},
1714
};

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.DS_Store
33
**/generated/
44
**/__snapshots__/
5-
coverage
5+
coverage/
66
dist
77
node_modules
88
yarn.lock

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ _Also if this appears in `examples/` feel free to update that, too!_
6060
6161
## Testing
6262
63-
Tests can be run with `npm test`. This will build the library first to ensure you’re not testing a stale build.
63+
```
64+
npm test
65+
```
6466
6567
## Help needed
6668

bin/cli.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async function generateSchema(pathToSpec) {
125125
outputFilePath = path.join(outputFilePath, filename);
126126
}
127127

128-
await fs.promises.writeFile(outputFilePath, result, "utf8");
128+
fs.writeFileSync(outputFilePath, result, "utf8");
129129

130130
const timeEnd = process.hrtime(timeStart);
131131
const time = timeEnd[0] + Math.round(timeEnd[1] / 1e6);
@@ -153,8 +153,7 @@ async function main() {
153153

154154
// handle remote schema, exit
155155
if (/^https?:\/\//.test(pathToSpec)) {
156-
if (output !== "." && output === OUTPUT_FILE)
157-
await fs.promises.mkdir(path.dirname(cli.flags.output), { recursive: true });
156+
if (output !== "." && output === OUTPUT_FILE) fs.mkdirSync(path.dirname(cli.flags.output), { recursive: true });
158157
await generateSchema(pathToSpec);
159158
return;
160159
}
@@ -183,7 +182,7 @@ async function main() {
183182
} else {
184183
outputDir = path.dirname(outputDir); // single files: just use output parent dir
185184
}
186-
await fs.promises.mkdir(outputDir, { recursive: true }); // recursively make parent dirs
185+
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
187186
}
188187
await generateSchema(specPath);
189188
})

jest.config.js

-10
This file was deleted.

0 commit comments

Comments
 (0)