Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm i
- run: npm run ci
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: JEST Tests
path: reports/jest-*.xml
reporter: jest-junit
build:
runs-on: ubuntu-latest

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@ dist
.pnp.*

dist
src/environment/sdk.js
src/environment/sdk.js
reports
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.4] - 2025-01-13

### Changed

- Fixed FS module not being available in the SDK.
- Clarified some types in the input SDK.
- General cleanup of some comments.

## [0.0.3] - 2025-01-10

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Please review USDR’s general guidelines for software & data, too: https://policies.usdigitalresponse.org/data-and-software-guidelines**

[![Code of Conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat)](./CODE_OF_CONDUCT.md)
[![Code of Conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat)](./CODE_OF_CONDUCT.md) ![Test and lint](https://github.com/usdigitalresponse/jest-environment-airtable-script/actions/workflows/ci.yml/badge.svg)

# Jest Airtable Script

Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint'
export default [
...tseslint.config(eslint.configs.recommended, tseslint.configs.recommended),
{
ignores: ['**/__sdk.js', '**/*.test.ts'],
ignores: ['**/sdk.js', '**/*.test.ts'],
},
{
rules: {
Expand Down
62 changes: 45 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-environment-airtable-script",
"version": "0.0.3",
"version": "0.0.4",
"description": "A jest environment for testing Airtable scripts in extensions and automations",
"license": "Apache-2.0",
"author": "",
Expand Down Expand Up @@ -33,8 +33,9 @@
"build:sdk": "rollup -c rollup-sdk.config.mjs",
"build:package": "rollup -c rollup.config.mjs",
"jest": "JEST_AIRTABLE_TS_DEV=true jest",
"jest:ci": "JEST_AIRTABLE_TS_DEV=true jest --reporters=default --reporters=jest-junit",
"test": "run-s build:sdk jest",
"ci": "run-s lint test",
"ci": "run-s lint build:sdk jest:ci",
"watch": "npm-watch test",
"lint": "eslint ./src",
"prepare": "husky"
Expand All @@ -60,6 +61,7 @@
"eslint": "^9.17.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"npm-run-all": "^4.1.5",
"npm-watch": "^0.13.0",
"rollup": "^4.29.1",
Expand All @@ -69,8 +71,15 @@
"typescript-eslint": "^8.19.0"
},
"dependencies": {
"camelize-ts": "^3.0.0",
"detect-ts-node": "^1.0.5",
"luxon": "^3.5.0"
},
"jest-junit": {
"outputDirectory": "reports",
"outputName": "jest-junit.xml",
"ancestorSeparator": " › ",
"uniqueOutputName": "false",
"suiteNameTemplate": "{filepath}",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}"
}
}
1 change: 0 additions & 1 deletion src/environment/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Taken from:
* @see https://github.com/Airtable/blocks/blob/6c0a2ed709a34e28cb3e999fc6cc6406eaa3817b/packages/sdk/src/types/mutations.ts
*/

const MutationTypes = Object.freeze({
SET_MULTIPLE_RECORD_CELL_VALUES: 'setMultipleRecordCellValues' as const,
DELETE_RECORD: 'deleteRecord' as const,
Expand Down
2 changes: 1 addition & 1 deletion src/environment/sdk/globals/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { pascalCase } from '../../lib/pascal-case'
import { MutationTypes } from '../../../mutation-types'
import { FixtureTable } from '../globals'

interface Base {
type Base = {
id: string | null
name: string | null
activeCollaborators: Array<Collaborator> | null
Expand Down
8 changes: 8 additions & 0 deletions src/environment/sdk/globals/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import type { Mutation } from './mutations'
import type { FieldType } from './base/field'
import type { ViewType } from './base/view'

/**
* The "fixture" types are loose types used to defined base objects
* exported from the Test Fixture Generator extension. Since these
* are pretty inconsisstent, there are anumber of optional keys.
*/
type FixtureField = {
id: string
name: string
Expand Down Expand Up @@ -45,6 +50,9 @@ type FixtureBase = {
collaborators: Collaborator[]
}

/**
* Declare all the global variables that are available in the scripting environment.
*/
declare global {
var __currentUser: Collaborator | undefined
var __inAutomation: boolean
Expand Down
Loading
Loading