Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support knex 0.16 #940

Merged
merged 3 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@types/extend": "^3.0.0",
"@types/glob": "^7.0.0",
"@types/is": "0.0.21",
"@types/knex": "^0.15.1",
"@types/methods": "^1.1.0",
"@types/mocha": "^5.2.5",
"@types/ncp": "^2.0.1",
Expand Down
10 changes: 8 additions & 2 deletions scripts/init-test-fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import { BUILD_DIRECTORY, globP, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils';
import { BUILD_DIRECTORY, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils';
import { readdir } from 'fs';
import * as pify from 'pify';
import * as semver from 'semver';
Expand All @@ -8,7 +8,7 @@ const readdirP: (path: string) => Promise<string[]> = pify(readdir);

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

// Run `npm install` for package fixtures
const packageFixtures = JSON.parse(await readFileP('./test/fixtures/plugin-fixtures.json', 'utf8') as string);
await mkdirP('./build/test/plugins/fixtures').catch((e: { errno?: number }) => {
// -17: EEXIST (it's OK if this directory already exists)
if (e.errno !== -17) {

This comment was marked as spam.

throw e;
}
});
for (const packageName in packageFixtures) {
const packageDirectory = `./build/test/plugins/fixtures/${packageName}`;
let fixtureExists = true;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin-knex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ module.exports = [
unpatch: unpatchClient
},
{
// knex 0.10.x and 0.11.x do not need patching
versions: '>=0.10 <=0.11'
// these knex versions do not need patching
versions: '>=0.10 <=0.11 || >=0.14 <=0.16'
}
];

Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/plugin-fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@
},
"_mainModule": "knex"
},
"knex0.14": {
"dependencies": {
"knex": "^0.14.0",
"mysql": "^2.13.0"
},
"_mainModule": "knex"
},
"knex0.16": {
"dependencies": {
"knex": "^0.16.0",
"mysql": "^2.13.0"
},
"_mainModule": "knex"
},
"koa1": {
"dependencies": {
"koa": "^1.1.2"
Expand Down
Loading