Skip to content

Commit

Permalink
refactor(testing/tests): convert require to import
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Jun 7, 2022
1 parent 4fd6e42 commit b619a0c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions testing/tests/destructive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
* with any of the files there.
*/

const fs = require("fs");
const fse = require("fs-extra");
const path = require("path");
const { execSync } = require("child_process");
import fs from "fs";
import fse from "fs-extra";
import path from "path";
import { execSync } from "child_process";

const tempy = require("tempy");
import tempy from "tempy";

const CONTENT_DIR = path.resolve(path.join("testing", "content"));
const BUILD_DIR = path.resolve(path.join("client", "build"));
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/developing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { test, expect } = require("@playwright/test");
const got = require("got");
import { test, expect } from "@playwright/test";
import got from "got";

const DEV_BASE_URL =
process.env.DEVELOPING_DEV_BASE_URL || "http://localhost:3000";
Expand Down
6 changes: 3 additions & 3 deletions testing/tests/filecheck.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require("fs");
const path = require("path");
import fs from "fs";
import path from "path";

const { checkFile } = require("../../filecheck/checker");
import { checkFile } from "../../filecheck/checker";

const dirname = __dirname;

Expand Down
2 changes: 1 addition & 1 deletion testing/tests/headless.auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { test, expect } = require("@playwright/test");
import { test, expect } from "@playwright/test";

function testURL(pathname = "/") {
const PORT = parseInt(process.env.SERVER_PORT || "5042");
Expand Down
2 changes: 1 addition & 1 deletion testing/tests/headless.index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { test, expect } = require("@playwright/test");
import { test, expect } from "@playwright/test";

function testURL(pathname = "/") {
const PORT = parseInt(process.env.SERVER_PORT || "5042");
Expand Down
2 changes: 1 addition & 1 deletion testing/tests/headless.plus.bookmarks.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
const { test, expect } = require("@playwright/test");
import { test, expect } from "@playwright/test";
function testURL(pathname = "/") {
const PORT = parseInt(process.env.SERVER_PORT || "5000");
Expand Down
2 changes: 1 addition & 1 deletion testing/tests/headless.search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { test, expect } = require("@playwright/test");
import { test, expect } from "@playwright/test";

function testURL(pathname = "/") {
return "http://localhost:5042" + pathname;
Expand Down
2 changes: 1 addition & 1 deletion testing/tests/headless.sitesearch.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { test, expect } = require("@playwright/test");
import { test, expect } from "@playwright/test";

function testURL(pathname = "/") {
return "http://localhost:5042" + pathname;
Expand Down
8 changes: 4 additions & 4 deletions testing/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fs = require("fs");
const path = require("path");
import fs from "fs";
import path from "path";

const cheerio = require("cheerio");
const sizeOf = require("image-size");
import cheerio from "cheerio";
import sizeOf from "image-size";

const buildRoot = path.join("client", "build");

Expand Down
6 changes: 3 additions & 3 deletions testing/tests/offline-db.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
import fs from "fs";
import path from "path";
import crypto from "crypto";

test("db.ts should be identical (PWA vs. Client)", () => {
function sha256sum(path) {
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/redirects.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const got = require("got");
const braces = require("braces");
import got from "got";
import braces from "braces";

function serverURL(pathname = "/") {
const PORT = parseInt(process.env.SERVER_PORT || "5042");
Expand Down

0 comments on commit b619a0c

Please sign in to comment.