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

add build and test workflow #9

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
21 changes: 21 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build and Test Checks

on: [pull_request]

jobs:
build-and-test:

runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- run: npm ci
- run: npm run build
- run: npm test
2 changes: 1 addition & 1 deletion test/mock/text.mock.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const MOCK_NAMESPACE = 'namespace';
export const MOCK_DATE = '1970-01-01 01:00:00.000+1';
export const MOCK_DATE = '1999-01-01 00:00:00.000+0';
4 changes: 2 additions & 2 deletions test/unit/formatting/humanFormat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import winston from 'winston';

import * as humanFormat from '../../../src/formatting/humanFormat';
import { MOCK_INFO, MOCK_HUMAN_MESSAGE, MOCK_FORMATTED_HUMAN_MESSAGE } from '../../mock/data.mock';
import { MOCK_NAMESPACE } from '../../mock/text.mock';
import { MOCK_DATE, MOCK_NAMESPACE } from '../../mock/text.mock';

describe('humanFormat test suites', () => {
afterEach(() => {
Expand All @@ -12,7 +12,7 @@ describe('humanFormat test suites', () => {

describe('setHumanMessage test', () => {
beforeEach(() => {
jest.useFakeTimers().setSystemTime();
jest.useFakeTimers().setSystemTime(new Date(MOCK_DATE));
});

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/formatting/jsonFormat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import winston from 'winston';
import * as jsonFormat from '../../../src/formatting/jsonFormat';

import { MOCK_INFO, MOCK_JSON_OBJECT, MOCK_JSON_STRINGIFIED } from '../../mock/data.mock';
import { MOCK_NAMESPACE } from '../../mock/text.mock';
import { MOCK_DATE, MOCK_NAMESPACE } from '../../mock/text.mock';

describe('jsonFormat test suites', () => {
afterEach(() => {
Expand All @@ -13,7 +13,7 @@ describe('jsonFormat test suites', () => {

describe('setJsonMessage Test', () => {
beforeEach(() => {
jest.useFakeTimers().setSystemTime();
jest.useFakeTimers().setSystemTime(new Date(MOCK_DATE));
});
afterEach(() => {
jest.useRealTimers();
Expand Down