Skip to content

Commit

Permalink
refactor: remove require assign import
Browse files Browse the repository at this point in the history
  • Loading branch information
sixmen committed Oct 26, 2024
1 parent 5d4920e commit ca4aab3
Show file tree
Hide file tree
Showing 31 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/cormo/test/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as cormo from '..';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/aggregation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { Order as OrderRef } from './cases/aggregation';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/archive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { UserRef, PostRef } from './cases/archive';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/association.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import cases_has_many from './cases/association_has_many';
import cases_has_one from './cases/association_has_one';
import cases_include from './cases/association_include';
import cases_include_lean from './cases/association_include_lean';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { User as UserRef } from './cases/basic';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql', 'redis'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/callbacks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { UserRef } from './cases/callbacks';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/cases/adapter-mongodb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { ObjectId } from 'mongodb';
import * as cormo from '../..';
import _g = require('../support/common');
import _g from '../support/common';

export default function (models: { connection: cormo.Connection<cormo.MongoDBAdapter> | null }) {
describe('issues', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/cases/adapter-mysql.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as cormo from '../..';
import _g = require('../support/common');
import _g from '../support/common';

export default function (models: { connection: cormo.Connection<cormo.MySQLAdapter> | null }) {
describe('issues', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/cases/adapter-postgresql.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as cormo from '../..';
import _g = require('../support/common');
import _g from '../support/common';

export default function (models: { connection: cormo.Connection<cormo.PostgreSQLAdapter> | null }) {
describe('issues', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/cases/javascript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global it */

const { expect } = require('chai');
const _g = require('../support/common');
const _g = require('../support/common').default;

async function _createUsers(User, data) {
if (!data) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/constraint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as cormo from '..';
import cases, { PostRef, UserRef } from './cases/constraint';
import cases_multicolumn, { VersionRef } from './cases/constraint_multicolumn';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/geospatial.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as cormo from '..';
import cases, { PlaceRef } from './cases/geospatial';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/integrity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { TeamRef, EventRef, CommentRef } from './cases/integrity';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/javascript.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, before, beforeEach, after */

const _g = require('./support/common');
const _g = require('./support/common').default;

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];
_dbs.forEach(function (db) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/join.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { ComputerRef, PostRef, UserRef } from './cases/join';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/manipulate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { UserRef, PostRef } from './cases/manipulate';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/misc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cases from './cases/misc';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/mixing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ComputerRef, PostRef, UserRef } from './cases/association';
import cases_as from './cases/association_as';
import cases_belongs_to from './cases/association_belongs_to';
import cases_has_many from './cases/association_has_many';
import _g = require('./support/common');
import _g from './support/common';

if (_g.db_configs.mysql && _g.db_configs.mongodb) {
describe('mixing several database', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/nested.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cases from './cases/nested';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import cases_op from './cases/query_op';
import cases_stream from './cases/query_stream';
import cases_update from './cases/query_update';
import cases_upsert from './cases/query_upsert';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cases from './cases/schema';
import cases_description from './cases/schema_description';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as cormo from '..';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql', 'redis'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/support/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ if (process.env.DIRTY_TRACKING) {

console.log(`Run test with dirty_tracking=${_g.BaseModel.dirty_tracking}`);

export = _g;
export default _g;
2 changes: 1 addition & 1 deletion packages/cormo/test/timestamp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { UserRef } from './cases/timestamp';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cases_bind from './cases/transaction_bind';
import cases_block from './cases/transaction_block';
import cases_etc from './cases/transaction_etc';
import cases_full_control from './cases/transaction_full_control';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cases, { Type as TypeRef } from './cases/type';
import cases_compare from './cases/type_compare';
import cases_options from './cases/type_options';
import cases_update from './cases/type_update';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql'];

Expand Down
2 changes: 1 addition & 1 deletion packages/cormo/test/validate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cormo from '..';
import cases, { User as UserRef } from './cases/validate';
import _g = require('./support/common');
import _g from './support/common';

const _dbs = ['mysql', 'mongodb', 'sqlite3', 'sqlite3_memory', 'postgresql', 'redis'];

Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ const _g = {
db_configs,
};

export = _g;
export default _g;
3 changes: 1 addition & 2 deletions packages/graphql/test/createDefaultCrudSchema/association.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { expect } from 'chai';
import * as cormo from 'cormo';
import { graphql, GraphQLSchema, printSchema } from 'graphql';
import { BelongsTo, Column, createDefaultCrudSchema, Model } from '../..';
// eslint-disable-next-line @typescript-eslint/no-require-imports
import _g = require('../common');
import _g from '../common';

class UserRef extends cormo.BaseModel {
public name!: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/graphql/test/createDefaultCrudSchema/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { expect } from 'chai';
import * as cormo from 'cormo';
import { graphql, GraphQLSchema, printSchema } from 'graphql';
import { Column, createDefaultCrudSchema, Model } from '../..';
// eslint-disable-next-line @typescript-eslint/no-require-imports
import _g = require('../common');
import _g from '../common';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
class UserRef extends cormo.BaseModel {
Expand Down
3 changes: 1 addition & 2 deletions packages/graphql/test/createDefaultCrudSchema/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import * as cormo from 'cormo';
import { graphql, GraphQLSchema, printSchema } from 'graphql';
import sinon, { createSandbox } from 'sinon';
import { Column, createDefaultCrudSchema, Model } from '../..';
// eslint-disable-next-line @typescript-eslint/no-require-imports
import _g = require('../common');
import _g from '../common';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
class UserRef extends cormo.BaseModel {
Expand Down

0 comments on commit ca4aab3

Please sign in to comment.