JSPM

@yoshi389111/fake-xmlservice

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q24785F
  • License MIT

Fake XmlService for Node.js, enabling local testing of Google Apps Script XML code.

Package Exports

  • @yoshi389111/fake-xmlservice

Readme

@yoshi389111/fake-xmlservice

This library provides a Node.js implementation of Google Apps Script's XmlService.
It allows you to parse and serialize XML locally, making it easy to test and develop code that depends on XmlService outside the Google Apps Script environment.

Installation

You can install this library via npm:

npm install --save-dev @yoshi389111/fake-xmlservice

Usage

@yoshi389111/fake-xmlservice provides implementations of XmlService that can be used in unit tests.

You don't import/require it directly in your test files. Instead, configure your test runner to load it automatically before your tests run.

Jest

In your jest.config.ts (or jest.config.js), add this library to setupFilesAfterEnv:

import type { Config } from 'jest';

const config: Config = {
  // ...
  setupFilesAfterEnv: [ '@yoshi389111/fake-xmlservice' ],
  // ...
};

export default config;

This ensures the implementations are available globally during your Jest tests.

Vitest

In your vitest.config.ts, use the setupFiles option:

import { defineConfig } from 'vitest/config';

export default defineConfig({
  // ...
  test: {
    // ...
    setupFiles: ['@yoshi389111/fake-xmlservice'],
    // ...
  },
  // ...
});

Now the fake services will be registered before your tests run.

© 2025 SATO Yoshiyuki. Licensed under the MIT License.