Skip to content

Commit

Permalink
Merge pull request #264 from bvandercar-vt/refactor/test-imports
Browse files Browse the repository at this point in the history
tests: use import instead of require
  • Loading branch information
archfz authored Nov 13, 2024
2 parents 1df940e + f0c84e8 commit 83c16dd
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 37 deletions.
2 changes: 1 addition & 1 deletion test/mocha_debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {expect} = require('chai');
import { expect } from 'chai'

describe('Always red test', function () {
before(function () {
Expand Down
3 changes: 1 addition & 2 deletions test/specs/commandsLogging.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
runTest,
commandBase, logLastRun,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'

describe('Commands logging.', () => {

Expand Down
3 changes: 1 addition & 2 deletions test/specs/compactLogs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
runTest,
commandBase, logLastRun,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'

describe('Compact logs.', () => {

Expand Down
3 changes: 1 addition & 2 deletions test/specs/componentTesting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
runTest,
commandBase, logLastRun,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'

describe('Component testing support.', () => {

Expand Down
3 changes: 1 addition & 2 deletions test/specs/extendedController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
expectOutputFilesToBeCorrect,
outputCleanUpAndInitialization, logLastRun,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'
require('chai').config.truncateThreshold = 0;

describe('Extended controller.', () => {
Expand Down
4 changes: 1 addition & 3 deletions test/specs/filteringAndConditionalLogging.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import {
runTest,
commandBase, logLastRun,
} from "../utils";

const {expect} = require('chai');
const chalk = require('chalk');
import { expect } from 'chai'

describe('Filtering and conditional logging.', () => {

Expand Down
4 changes: 1 addition & 3 deletions test/specs/misc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import {
runTestContinuous,
outputCleanUpAndInitialization,
expectOutputFilesToBeCorrect,
PADDING,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'

describe('Misc.', () => {

Expand Down
7 changes: 3 additions & 4 deletions test/specs/otherPluginIntegration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import {
commandBase,
expectOutFilesMatch, logLastRun,
} from "../utils";

const {expect} = require('chai');
const fs = require('fs');
const glob = require('glob');
import { expect } from 'chai'
import * as fs from 'fs'
import * as glob from 'glob'

describe('Other plugin integrations.', () => {

Expand Down
7 changes: 3 additions & 4 deletions test/specs/outputCompactLogs.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { runTest, commandBase, logLastRun, clean } from "../utils";

const {expect} = require('chai');
const fs = require('fs');
const path = require('path');
import { expect } from 'chai'
import * as fs from 'fs'
import * as path from 'path'

function getOutputFileContents() {
const outputFile = path.join(__dirname, '../output/out.txt');
Expand Down
11 changes: 5 additions & 6 deletions test/specs/outputToFiles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import {
expectOutFilesMatch,
outputCleanUpAndInitialization, logLastRun,
} from "../utils";

const {expect} = require('chai');
const fs = require('fs');
const fsExtra = require('fs-extra');
const path = require('path');
const glob = require('glob');
import { expect } from 'chai'
import * as fs from 'fs'
import * as path from 'path'
import * as glob from 'glob'
import fsExtra from 'fs-extra'

describe('Output to files.', () => {

Expand Down
3 changes: 1 addition & 2 deletions test/specs/validation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {
runTest,
commandBase, logLastRun,
} from "../utils";

const {expect} = require('chai');
import { expect } from 'chai'

describe('Validation.', () => {

Expand Down
12 changes: 6 additions & 6 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const {exec, spawn} = require('child_process');
const {expect} = require('chai');
const fs = require('fs');
const path = require('path');
const os = require('os');
const chalk = require('chalk');
import { exec, spawn } from 'child_process'
import { expect } from 'chai'
import * as fs from 'fs'
import * as path from 'path'
import * as os from 'os'
import chalk from 'chalk'

let commandPrefix = 'node ./node_modules/.bin/cypress';

Expand Down

0 comments on commit 83c16dd

Please sign in to comment.