Skip to content

Commit

Permalink
Merge pull request #2248 from MoveOnOrg/kathy_node_upgrade
Browse files Browse the repository at this point in the history
Upgrade to Node 16
  • Loading branch information
ibrand authored Jan 5, 2023
2 parents 2e8c479 + 18ca36b commit 864c2ac
Show file tree
Hide file tree
Showing 48 changed files with 6,759 additions and 7,952 deletions.
8 changes: 4 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"presets": ["react", "env", "stage-0"],
"only": ["*.js", "*.jsx"],
"presets": ["@babel/preset-react", "@babel/preset-env", ["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }]],
"only": ["./**/*.js", "./**/*.jsx"],
"plugins": [
["transform-runtime", {
"polyfill": false,
"@babel/plugin-proposal-export-default-from",
["@babel/plugin-transform-runtime", {
"regenerator": true
}]
],
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["airbnb", "prettier"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"env": { "jest": true, "node": true, "browser": true, "jasmine": true }
}
6 changes: 3 additions & 3 deletions .github/workflows/cypress-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [12.x]
node-version: [16.x]
services:
redis:
image: redis
Expand All @@ -24,9 +24,9 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v4
env:
DEBUG: '@cypress/github-action'
NODE_ENV: test
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/jest-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [10.x, 11.x, 12.x]
node-version: [14.x, 15.x, 16.x]
services:
redis:
image: redis
Expand All @@ -24,7 +24,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -36,7 +36,9 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-yarn-
- run: yarn
- run: yarn test
- env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: yarn test
test-rediscache-contactcache:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -55,7 +57,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -67,7 +69,9 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-rediscache-contactcache
- env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: yarn test-rediscache-contactcache
test-rediscache:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -86,7 +90,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -98,7 +102,9 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-rediscache
- env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: yarn test-rediscache
test-sqlite:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -108,7 +114,7 @@ jobs:
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -120,4 +126,6 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test-sqlite
- env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: yarn test-sqlite
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
PATH="/usr/local/bin:$PATH"
if [ -f $HOME/.nvm/nvm.sh ]
then
. $HOME/.nvm/nvm.sh
PATH="$HOME/.nvm/versions/node/v16.18.0/bin:$PATH"
fi

yarn lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
16.18.0
15 changes: 12 additions & 3 deletions __test__/backend.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isSqlite } from "../src/server/models/";
import { resolvers } from "../src/server/api/schema";
import { schema } from "../src/api/schema";
import { assignmentRequiredOrAdminRole } from "../src/server/api/errors";
Expand Down Expand Up @@ -175,7 +176,7 @@ async function createCampaign(user, title, description, organizationId) {

// graphQL tests

describe("graphql test suite", async () => {
describe("graphql test suite", () => {
beforeAll(
async () => await setupTest(),
global.DATABASE_SETUP_TEARDOWN_TIMEOUT
Expand Down Expand Up @@ -352,7 +353,7 @@ describe("graphql test suite", async () => {
}).save();
});

describe("contacts", async () => {
describe("contacts", () => {
let campaigns;
let contacts;
beforeEach(async () => {
Expand Down Expand Up @@ -621,7 +622,15 @@ describe("graphql test suite", async () => {
let parsedDate = new Date(copiedCampaign.due_by);
expect(parsedDate).toEqual(campaign.due_by);
} else {
expect(copiedCampaign.due_by).toEqual(campaign.due_by);
if (isSqlite) {
// Currently an open issue w/ datetime being stored as a string in SQLite3 for Jest tests: https://github.com/TryGhost/node-sqlite3/issues/1355. This results in milliseconds being truncated when getting campaign due_by
const campaignDueBy = campaign.due_by;

campaignDueBy.setMilliseconds(0);
expect(copiedCampaign.due_by).toEqual(campaignDueBy);
} else {
expect(copiedCampaign.due_by).toEqual(campaign.due_by);
}
}
if (
typeof copiedCampaign.features === "object" &&
Expand Down
8 changes: 5 additions & 3 deletions __test__/components/AssignmentSummary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function getAssignment({ isDynamic = false, counts = {} }) {
}

describe("AssignmentSummary text", function t() {
let summary;

beforeEach(() => {
this.summary = mount(
summary = mount(
<AssignmentSummary
muiTheme={muiTheme}
assignment={getAssignment({
Expand All @@ -64,10 +66,10 @@ describe("AssignmentSummary text", function t() {
(notInUSA, allowSendAll) => {
window.NOT_IN_USA = notInUSA;
window.ALLOW_SEND_ALL = allowSendAll;
const title = this.summary.find(CardHeader);
const title = summary.find(CardHeader);
expect(title.prop("title")).toBe("New Campaign");

const htmlWrapper = this.summary.findWhere(
const htmlWrapper = summary.findWhere(
d => d.length && d.type() === "div" && d.prop("dangerouslySetInnerHTML")
);
expect(htmlWrapper.prop("dangerouslySetInnerHTML")).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function genComponent(assignment, propertyOverrides = {}) {
return wrapper;
}

describe("ContactController process flows", async () => {
describe("ContactController process flows", () => {
it("Normal nondynamic assignment queue", async () => {
const assignment = genAssignment(
false,
Expand Down
Loading

0 comments on commit 864c2ac

Please sign in to comment.