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

Fix tests #988

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ git clone https://github.com/<your-github-username>/clasp.git
cd clasp
```
- Install dependencies: `npm install`
- Link-install this development version of `clasp`: `npm link`

### After Making a Change

Expand Down
2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

## How to Run Tests

Make sure you have completed the [development setup](/docs/develop.md#setup).

1. Log in: `clasp login`
1. Rebuild: `npm run build`
1. Set environmental variables:
Expand Down
16 changes: 11 additions & 5 deletions test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import os from 'os';
import path from 'path';

import {ClaspToken} from '../src/dotfile.js';
import {ClaspError} from '../src/clasp-error.js';
import {randomString} from './functions.js';

import type {OAuth2ClientOptions} from 'google-auth-library';
Expand All @@ -27,15 +28,20 @@ export const TEST_APPSSCRIPT_JSON_WITH_RUN_API = JSON.stringify({

// Travis Env Variables
export const IS_PR: boolean = process.env.CI === 'true';
export const SCRIPT_ID: string = process.env.SCRIPT_ID ?? '';
export const PROJECT_ID: string = process.env.PROJECT_ID ?? '';
export const PARENT_ID: string[] = [process.env.PROJECT_ID ?? ''];
const HOME: string = process.env.HOME ?? '';
if (process.env.SCRIPT_ID === undefined) {
throw new ClaspError('Environment variable SCRIPT_ID is not defined.');
}
export const SCRIPT_ID: string = process.env.SCRIPT_ID;
if (process.env.PROJECT_ID === undefined) {
throw new ClaspError('Environment variable PROJECT_ID is not defined.');
}
export const PROJECT_ID: string = process.env.PROJECT_ID;
export const PARENT_ID: string[] = [process.env.PROJECT_ID];

// Paths
export const CLASP_PATHS = {
clientCredsLocal: 'client_credentials.json',
rcGlobal: path.join(HOME, '.clasprc.json'),
rcGlobal: path.join(os.homedir(), '.clasprc.json'),
rcLocal: '.clasprc.json',
settingsLocal: '.clasp.json',
};
Expand Down