@friggframework/test 2.0.0--canary.710.91495fa.0 → 2.0.0--canary.702.ef0dc8c.0
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/README.md +2 -0
- package/mongodb.js +1 -11
- package/package.json +7 -8
- package/mongodb.db.test.js +0 -24
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# test-environment
|
|
2
2
|
|
|
3
|
+
> Canary publishes of this package are required because `@friggframework/devtools` depends on it at the matching canary version.
|
|
4
|
+
|
|
3
5
|
This package exports the `test-environment` defaults used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/test-environment).
|
|
4
6
|
|
|
5
7
|
Thanks for your interest!
|
package/mongodb.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
const { MongoMemoryServer } = require('mongodb-memory-server');
|
|
2
2
|
|
|
3
|
-
// Pin the MongoDB binary instead of relying on the library default. The old
|
|
4
|
-
// default (5.0.19) only ships Ubuntu 20.04 builds that link against OpenSSL
|
|
5
|
-
// 1.1 (libcrypto.so.1.1), which Ubuntu 24.04 (GitHub's ubuntu-latest) no
|
|
6
|
-
// longer ships, so the server failed to start in CI. MongoDB 8.0 has native
|
|
7
|
-
// Ubuntu 24.04 builds. MONGOMS_VERSION still overrides this for local use.
|
|
8
|
-
const MONGODB_BINARY_VERSION = process.env.MONGOMS_VERSION || '8.0.17';
|
|
9
|
-
|
|
10
3
|
class TestMongo {
|
|
11
4
|
#mongoServer;
|
|
12
5
|
|
|
13
6
|
// Start the in-memory mongo instance and set env variable for the app to use in its connection.
|
|
14
7
|
async start() {
|
|
15
|
-
this.#mongoServer = await MongoMemoryServer.create(
|
|
16
|
-
binary: { version: MONGODB_BINARY_VERSION },
|
|
17
|
-
});
|
|
8
|
+
this.#mongoServer = await MongoMemoryServer.create();
|
|
18
9
|
process.env.MONGO_URI = this.#mongoServer.getUri();
|
|
19
10
|
console.log('Started in memory mongo server', process.env.MONGO_URI);
|
|
20
11
|
}
|
|
@@ -28,5 +19,4 @@ class TestMongo {
|
|
|
28
19
|
|
|
29
20
|
module.exports = {
|
|
30
21
|
TestMongo,
|
|
31
|
-
MONGODB_BINARY_VERSION,
|
|
32
22
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/test",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.
|
|
4
|
+
"version": "2.0.0--canary.702.ef0dc8c.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/eslint-parser": "^7.18.9",
|
|
7
7
|
"eslint": "^8.22.0",
|
|
@@ -11,19 +11,18 @@
|
|
|
11
11
|
"eslint-plugin-no-only-tests": "^3.0.0",
|
|
12
12
|
"eslint-plugin-yaml": "^0.5.0",
|
|
13
13
|
"jest-runner-groups": "^2.2.0",
|
|
14
|
-
"mongodb-memory-server": "^
|
|
14
|
+
"mongodb-memory-server": "^8.9.0",
|
|
15
15
|
"open": "^8.4.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@friggframework/eslint-config": "2.0.0--canary.
|
|
19
|
-
"@friggframework/prettier-config": "2.0.0--canary.
|
|
18
|
+
"@friggframework/eslint-config": "2.0.0--canary.702.ef0dc8c.0",
|
|
19
|
+
"@friggframework/prettier-config": "2.0.0--canary.702.ef0dc8c.0",
|
|
20
20
|
"jest": "^29.7.0",
|
|
21
21
|
"prettier": "^2.7.1"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"lint:fix": "prettier --write --loglevel error . && eslint . --fix",
|
|
25
|
-
"test": "jest --passWithNoTests
|
|
26
|
-
"test:db": "jest --testMatch '**/*.db.test.js'"
|
|
25
|
+
"test": "jest --passWithNoTests # TODO"
|
|
27
26
|
},
|
|
28
27
|
"author": "",
|
|
29
28
|
"license": "MIT",
|
|
@@ -36,9 +35,9 @@
|
|
|
36
35
|
"url": "https://github.com/friggframework/frigg/issues"
|
|
37
36
|
},
|
|
38
37
|
"homepage": "https://github.com/friggframework/frigg#readme",
|
|
39
|
-
"description": "",
|
|
38
|
+
"description": "Shared Jest helpers and Mongo memory-server setup for Frigg packages.",
|
|
40
39
|
"publishConfig": {
|
|
41
40
|
"access": "public"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ef0dc8cb6c6f56048a61b6759faad7322046925d"
|
|
44
43
|
}
|
package/mongodb.db.test.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const net = require('node:net');
|
|
2
|
-
const { TestMongo } = require('./mongodb');
|
|
3
|
-
|
|
4
|
-
// Opt-in DB test (`npm run test:db`): proves the pinned MongoDB binary
|
|
5
|
-
// downloads and starts on the CI image (Ubuntu 24.04 has no OpenSSL 1.1,
|
|
6
|
-
// which the old 5.0.x default needed).
|
|
7
|
-
describe('TestMongo', () => {
|
|
8
|
-
const testMongo = new TestMongo();
|
|
9
|
-
|
|
10
|
-
beforeAll(() => testMongo.start(), 120_000);
|
|
11
|
-
afterAll(() => testMongo.stop());
|
|
12
|
-
|
|
13
|
-
it('starts mongod and exports a reachable MONGO_URI', async () => {
|
|
14
|
-
const { hostname, port } = new URL(process.env.MONGO_URI);
|
|
15
|
-
|
|
16
|
-
await new Promise((resolve, reject) => {
|
|
17
|
-
const socket = net.connect(Number(port), hostname, () => {
|
|
18
|
-
socket.end();
|
|
19
|
-
resolve();
|
|
20
|
-
});
|
|
21
|
-
socket.on('error', reject);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|