Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 0b404a1

Browse files
authored
feat: support knex 0.16 (#940)
1 parent 96863e7 commit 0b404a1

7 files changed

Lines changed: 212 additions & 211 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@types/extend": "^3.0.0",
5555
"@types/glob": "^7.0.0",
5656
"@types/is": "0.0.21",
57+
"@types/knex": "^0.15.1",
5758
"@types/methods": "^1.1.0",
5859
"@types/mocha": "^5.2.5",
5960
"@types/ncp": "^2.0.1",

scripts/init-test-fixtures.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path';
2-
import { BUILD_DIRECTORY, globP, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils';
2+
import { BUILD_DIRECTORY, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils';
33
import { readdir } from 'fs';
44
import * as pify from 'pify';
55
import * as semver from 'semver';
@@ -8,7 +8,7 @@ const readdirP: (path: string) => Promise<string[]> = pify(readdir);
88

99
export async function initTestFixtures(installPlugins: boolean) {
1010
// Copy fixtures to build directory
11-
const fixtureDirectories = await globP('./test/**/fixtures');
11+
const fixtureDirectories = ['./test/fixtures'];
1212
await Promise.all(fixtureDirectories.map(async (fixtureDirectory) => {
1313
const newLocation = `${BUILD_DIRECTORY}/${path.relative('.', fixtureDirectory)}`;
1414
await ncpP(fixtureDirectory, newLocation);
@@ -20,6 +20,12 @@ export async function initTestFixtures(installPlugins: boolean) {
2020

2121
// Run `npm install` for package fixtures
2222
const packageFixtures = JSON.parse(await readFileP('./test/fixtures/plugin-fixtures.json', 'utf8') as string);
23+
await mkdirP('./build/test/plugins/fixtures').catch((e: { code?: string }) => {
24+
// it's OK if this directory already exists
25+
if (e.code !== 'EEXIST') {
26+
throw e;
27+
}
28+
});
2329
for (const packageName in packageFixtures) {
2430
const packageDirectory = `./build/test/plugins/fixtures/${packageName}`;
2531
let fixtureExists = true;

src/plugins/plugin-knex.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ module.exports = [
5555
unpatch: unpatchClient
5656
},
5757
{
58-
// knex 0.10.x and 0.11.x do not need patching
59-
versions: '>=0.10 <=0.11'
58+
// these knex versions do not need patching
59+
versions: '>=0.10 <=0.11 || >=0.14 <=0.16'
6060
}
6161
];
6262

test/fixtures/plugin-fixtures.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,20 @@
9595
},
9696
"_mainModule": "knex"
9797
},
98+
"knex0.14": {
99+
"dependencies": {
100+
"knex": "^0.14.0",
101+
"mysql": "^2.13.0"
102+
},
103+
"_mainModule": "knex"
104+
},
105+
"knex0.16": {
106+
"dependencies": {
107+
"knex": "^0.16.0",
108+
"mysql": "^2.13.0"
109+
},
110+
"_mainModule": "knex"
111+
},
98112
"koa1": {
99113
"dependencies": {
100114
"koa": "^1.1.2"

0 commit comments

Comments
 (0)